Changeset 21 for trunk


Ignore:
Timestamp:
02/25/13 11:47:25 (12 years ago)
Author:
lucsch
Message:
  • TmDmCreator is now working (supports language selection)
  • Adding swisstopo data model definition
Location:
trunk
Files:
3 added
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/tmdmcreator/docs/uml/tmdmcreator/128033.diagram

    r19 r21  
    33classcanvas 128033 class_ref 128033 // TmDmCreator 
    44  draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_context default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language default show_context_mode default auto_label_position default show_relation_modifiers default show_relation_visibility default show_infonote default shadow default show_stereotype_properties default 
    5   xyz 34.4 74.1 2000 
     5  xyz 32.3 74.3 2000 
    66end 
    77classcanvas 128161 class_ref 128161 // TmDmCopier 
    88  draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_context default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language default show_context_mode default auto_label_position default show_relation_modifiers default show_relation_visibility default show_infonote default shadow default show_stereotype_properties default 
    9   xyz 400.9 184.2 2000 
     9  xyz 528.3 153.4 2000 
    1010end 
    1111classcanvas 128417 class_ref 141217 // TmDmProcessor 
    1212  draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_context default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language default show_context_mode default auto_label_position default show_relation_modifiers default show_relation_visibility default show_infonote default shadow default show_stereotype_properties default 
    13   xyz 196.3 408.1 2000 
     13  xyz 103.9 345.5 2000 
    1414end 
    1515classcanvas 128545 class_ref 141345 // TmDmProcessorSimple 
    1616  draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_context default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language default show_context_mode default auto_label_position default show_relation_modifiers default show_relation_visibility default show_infonote default shadow default show_stereotype_properties default 
    17   xyz 363.9 588.5 2000 
     17  xyz 363.7 588.3 2000 
    1818end 
    1919classcanvas 128801 class_ref 141473 // TmDmProcessorAttributs 
    2020  draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_context default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language default show_context_mode default auto_label_position default show_relation_modifiers default show_relation_visibility default show_infonote default shadow default show_stereotype_properties default 
    21   xyz 17.9 693.8 2000 
     21  xyz 17.9 693.2 2000 
    2222end 
    2323relationcanvas 128673 relation_ref 128033 // <generalisation> 
  • trunk/tmdmcreator/docs/uml/tmdmcreator/33.session

    r19 r21  
    1 window_sizes 959 1031 253 700 838 136 
     1window_sizes 1440 852 253 1181 659 136 
    22diagrams 
    33  active  classdiagram_ref 128033 // tmdmcreator 
    4     1573 819 90 4 0 0 
     4    1177 639 90 4 0 0 
    55end 
    66show_stereotypes 
    7 selected operation_ref 144161 // _ProcessAttributesValues 
     7selected operation_ref 150689 // SwitchCols 
    88open 
     9  class_ref 128033 // TmDmCreator 
    910  class_ref 128161 // TmDmCopier 
    1011  operation_ref 136481 // ProcessBlock 
  • trunk/tmdmcreator/docs/uml/tmdmcreator/tmdmcreator.prj

    r19 r21  
    11format 75 
    22"tmdmcreator" 
    3   revision 6 
     3  revision 7 
    44  modified_by 33 "lucien" 
    55 
     
    251251      operation 137505 "ProcessFiles" 
    252252        public explicit_return_type "bool" 
    253         nparams 1 
     253        nparams 2 
    254254          param out name "errorsmsg" explicit_type "wxArrayString" 
    255         cpp_decl "    ${comment}${friend}${static}${inline}${virtual}${type} ${name}${(}${t0} & ${p0}${v0}${)}${const}${volatile}${throw}${abstract}; 
    256 " 
    257         cpp_def "${comment}${inline}${type} ${class}::${name}${(}${t0} & ${p0}${)}${const}${volatile}${throw}${staticnl}{ 
     255          param in name "languagecolumn" explicit_type "int" 
     256        cpp_decl "    ${comment}${friend}${static}${inline}${virtual}${type} ${name}${(}${t0} & ${p0}${v0}, ${t1} ${p1}${)}${const}${volatile}${throw}${abstract}; 
     257" 
     258        cpp_def "${comment}${inline}${type} ${class}::${name}${(}${t0} & ${p0}, ${t1} ${p1}${)}${const}${volatile}${throw}${staticnl}{ 
    258259  ${body}} 
    259260" 
     
    379380      end 
    380381 
     382      attribute 155169 "m_LanguageCol" 
     383        protected explicit_type "int" 
     384        init_value "0" 
     385        cpp_decl "    ${comment}${static}${mutable}${volatile}${const}${type} ${name}${value}; 
     386" 
     387        java_decl "" 
     388        php_decl "" 
     389        python_decl "" 
     390        idl_decl "" 
     391        set_oper operation_ref 150817 // SetLanguageColumn 
     392      end 
     393 
     394      operation 150689 "SwitchCols" 
     395        protected explicit_return_type "wxString" 
     396        nparams 2 
     397          param in name "cols" explicit_type "wxArrayString" 
     398          param in name "values" explicit_type "wxArrayString" 
     399        cpp_decl "    ${comment}${friend}${static}${inline}${virtual}${type} ${name}${(}${t0} * ${p0}, ${t1} * ${p1}${)}${const}${volatile}${throw}${abstract}; 
     400" 
     401        cpp_def "${comment}${inline}${type} ${class}::${name}${(}const ${t0} & ${p0}, const ${t1} & ${p1}${)}${const}${volatile}${throw}${staticnl}{ 
     402  ${body}} 
     403" 
     404         
     405         
     406         
     407         
     408      end 
     409 
    381410      operation 135585 "TmDmProcessor" 
    382411        public explicit_return_type "" 
     
    435464         
    436465         
     466      end 
     467 
     468      operation 150817 "SetLanguageColumn" 
     469        force_body_gen public explicit_return_type "void" 
     470        nparams 1 
     471          param in name "value" explicit_type "int" 
     472        cpp_decl "    ${comment}${friend}${static}${inline}${virtual}${type} ${name}${(}${t0} ${p0}${)}${const}${volatile}${throw}; 
     473" 
     474        cpp_def "${comment}${inline}${type} ${class}::${name}${(}${t0} ${p0}${)}${const}${volatile}${throw}${staticnl}{ 
     475  m_LanguageCol = ${p0}; 
     476} 
     477" 
     478        cpp_name_spec "SetLanguageColumn" 
     479         
     480        java_name_spec "set${Name}" 
     481         
     482        php_name_spec "set${Name}" 
     483         
     484        python_name_spec "set${Name}" 
     485         
     486        idl_name_spec "set_${name}" 
     487        set_of_attribute attribute_ref 155169 // m_LanguageCol 
    437488      end 
    438489    end 
  • trunk/tmdmcreator/src/main.cpp

    r18 r21  
    3535        wxCMD_LINE_VAL_NONE, wxCMD_LINE_OPTION_HELP }, 
    3636    { wxCMD_LINE_SWITCH, "v", "verbose", "Be more verbose" }, 
    37     { wxCMD_LINE_SWITCH, "t", "toolmap", "toolmap output" }, 
    38     { wxCMD_LINE_SWITCH, "o", "overwrite", "overwrite output" },     
     37    { wxCMD_LINE_SWITCH, "t", "toolmap", "toolmap output (default is SQL)" }, 
     38    { wxCMD_LINE_SWITCH, "o", "overwrite", "overwrite output" }, 
     39    { wxCMD_LINE_OPTION, "l", "language", "language column (default is 0)", wxCMD_LINE_VAL_NUMBER, wxCMD_LINE_PARAM_OPTIONAL}, 
    3940    { wxCMD_LINE_PARAM, NULL, NULL, "[base structure sql file]"}, 
    4041    { wxCMD_LINE_PARAM, NULL, NULL, "[user structure sql file]"}, 
     
    8384    bool bVerbose = parser.Found("verbose"); 
    8485    bool bToolMap = parser.Found("toolmap"); 
     86    long myLanguage = 0; 
     87    if(parser.Found("language", &myLanguage) == true) { 
     88        wxPrintf(_("Using language column: %ld\n"), myLanguage); 
     89    } 
    8590    if (parser.Found("overwrite") && wxFileExists(parser.GetParam(3))) { 
    8691        wxRemoveFile(parser.GetParam(3)); 
     
    108113    } 
    109114     
    110     if (myCreator.ProcessFiles(myErrors) == false) { 
     115    if (myCreator.ProcessFiles(myErrors, myLanguage) == false) { 
    111116        if (bVerbose == true) { 
    112117            PrintArray(myErrors); 
  • trunk/tmdmcreator/src/tmdmcreator.cpp

    r19 r21  
    9191 
    9292 
    93 bool TmDmCreator::ProcessFiles(wxArrayString & errorsmsg) { 
     93bool TmDmCreator::ProcessFiles(wxArrayString & errorsmsg, int languagecolumn) { 
    9494    errorsmsg.Clear(); 
    9595    // Copy structure 
     
    109109    // Process layers 
    110110    TmDmProcessorSimple myProc(m_FileNameUserContent, m_FileNameOutSQL); 
     111    myProc.SetLanguageColumn(languagecolumn); 
    111112    int myThematicLayersStart = myProc.FindBlock(_T("thematic_layers")); 
    112113    if (myThematicLayersStart == wxNOT_FOUND) { 
     
    132133    // Process attributs 
    133134    TmDmProcessorAttributs myProcAttributs (m_FileNameUserContent, m_FileNameOutSQL); 
     135    myProcAttributs.SetLanguageColumn(languagecolumn); 
    134136    int myAttributStart = myProcAttributs.FindBlock(_T("attributs")); 
    135137    if (myAttributStart == wxNOT_FOUND) { 
  • trunk/tmdmcreator/src/tmdmcreator.h

    r16 r21  
    4242     
    4343    bool CheckFiles(wxArrayString & errormsg); 
    44     bool ProcessFiles(wxArrayString & errorsmsg);     
     44    bool ProcessFiles(wxArrayString & errorsmsg, int languagecolumn); 
    4545}; 
    4646#endif 
  • trunk/tmdmcreator/src/tmdmprocessor.cpp

    r19 r21  
    2121    m_FileSrc = src; 
    2222    m_FileDst = dest; 
     23    m_LanguageCol = 0; 
    2324} 
    2425 
     
    4243    } 
    4344    return wxNOT_FOUND; 
     45} 
     46 
     47 
     48 
     49wxString TmDmProcessor::SwitchCols(wxArrayString * cols, wxArrayString * values, int item) { 
     50    if (m_LanguageCol == 0) { 
     51        return values->Item(item); 
     52    } 
     53     
     54 
     55    if(cols->Item(item).Contains(_T("_0")) == true) { 
     56        return values->Item(item + m_LanguageCol); 
     57    } 
     58     
     59    wxString myColName = wxString::Format(_T("_%d"), m_LanguageCol); 
     60    if (cols->Item(item).Contains(myColName) == true) { 
     61        return values->Item(item - m_LanguageCol); 
     62    } 
     63    return values->Item(item); 
     64} 
     65 
     66 
     67 
     68void TmDmProcessor::SetLanguageColumn(int value) { 
     69    m_LanguageCol = value; 
    4470} 
    4571 
     
    104130        myInsert.Append(_T(") VALUES (")); 
    105131        for (unsigned int i = 0; i< mySQLCols.GetCount(); i++) { 
    106             myInsert.Append(wxString::Format(_T("\"%s\","), myValues.Item(i))); 
     132            myInsert.Append(wxString::Format(_T("\"%s\","), SwitchCols(&mySQLCols, &myValues, i))); 
    107133        } 
    108134        myInsert.RemoveLast(); 
     
    232258        wxString myInsert = _T("INSERT INTO `dmn_catalog` VALUES ("); 
    233259        for (unsigned int i = START_COL; i< mySQLCols.GetCount(); i++) { 
    234             myInsert.Append(wxString::Format(_T("\"%s\","), myValues.Item(i))); 
     260            myInsert.Append(wxString::Format(_T("\"%s\","), SwitchCols(&mySQLCols, &myValues, i))); 
    235261        } 
    236262        myInsert.RemoveLast(); 
  • trunk/tmdmcreator/src/tmdmprocessor.h

    r19 r21  
    3333    wxFileName m_FileDst; 
    3434     
     35    int m_LanguageCol; 
     36    wxString SwitchCols(wxArrayString * cols, wxArrayString * values, int item); 
     37     
    3538public: 
    3639    TmDmProcessor(const wxFileName & src, const wxFileName & dest); 
     
    3942    int FindBlock(const wxString & blockname); 
    4043    virtual bool ProcessBlock(int blockstart, const wxString & tablename) = 0; 
     44 
     45    void SetLanguageColumn(int value); 
    4146}; 
    4247 
  • trunk/tutorial/model_tutorial.tex

    r14 r21  
    115115  PRIMARY KEY (`OBJECT_ID`), 
    116116  KEY `LAYER_ATX_FKIndex1` (`OBJECT_ID`) 
    117 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 
     117) ENGINE=MyISAM DEFAULT CHARSET=utf8; 
    118118\end{lstlisting} 
    119119This code is the basic template for creating an attribute table. The number after layer\_at (see line 2) indicates the layer index and refers to the LAYER\_INDEX column in user\_content.txt. In our example layer\_at1 describe the attributes for the layer Boreholes\_PT. User attributes can then be added on line 4 of this template. 
Note: See TracChangeset for help on using the changeset viewer.