Changeset 18
- Timestamp:
- 02/22/13 13:30:00 (12 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/models/base/base_structure.sql
r8 r18 5 5 `CATALOG_ID` int(11) NOT NULL, 6 6 PRIMARY KEY (`ATTRIBUT_ID`,`CATALOG_ID`) 7 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 7 ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 8 8 9 9 -- dmn_catalog -- … … 17 17 `DESCRIPTION_4` varchar(255) DEFAULT NULL, 18 18 PRIMARY KEY (`CATALOG_ID`) 19 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 19 ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 20 20 21 21 -- dmn_layer_attribut -- … … 25 25 `ATTRIBUT_NAME` varchar(100) DEFAULT NULL, 26 26 PRIMARY KEY (`ATTRIBUT_ID`,`LAYER_INDEX`) 27 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 27 ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 28 28 29 29 -- dmn_layer_object -- … … 44 44 PRIMARY KEY (`OBJECT_ID`), 45 45 KEY `DMN_LAYER_OBJECT_FKIndex2` (`THEMATIC_LAYERS_LAYER_INDEX`,`OBJECT_ID`) 46 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 46 ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 47 47 48 48 -- dmn_layer_type -- … … 51 51 `TYPE_DESCRIPTION` varchar(20) NOT NULL COMMENT 'Layer type description', 52 52 PRIMARY KEY (`TYPE_CD`) 53 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 53 ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 54 54 55 55 … … 65 65 `SHORTCUT_DESC` varchar(255) DEFAULT NULL, 66 66 PRIMARY KEY (`SHORTCUT_CD`) 67 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 67 ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 68 68 69 69 INSERT INTO dmn_shortcut_key VALUES(1,"F1",""); … … 88 88 `PERCENT_SKIPPED` double DEFAULT NULL, 89 89 PRIMARY KEY (`LAYER_INDEX`) 90 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 90 ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 91 91 92 92 -- generic_aat -- … … 97 97 KEY `GENERIC_LINES_has_DMN_LAYER_OBJECT_FKIndex1` (`OBJECT_VAL_ID`), 98 98 KEY `GENERIC_LINES_has_DMN_LAYER_OBJECT_FKIndex2` (`OBJECT_GEOM_ID`) 99 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 99 ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 100 100 101 101 -- generic_dmn -- … … 104 104 `DESCRIPTION` varchar(255) DEFAULT NULL COMMENT 'Code description', 105 105 PRIMARY KEY (`CODE`) 106 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 106 ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 107 107 108 108 -- generic_frame -- … … 111 111 `OBJECT_GEOMETRY` linestring NOT NULL COMMENT 'Feature geometry', 112 112 PRIMARY KEY (`OBJECT_ID`) 113 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 113 ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 114 114 115 115 -- generic_labels -- … … 118 118 `OBJECT_GEOMETRY` multipoint NOT NULL, 119 119 PRIMARY KEY (`OBJECT_ID`) 120 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 120 ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 121 121 122 122 -- generic_lat -- … … 127 127 KEY `GENERIC_LABELS_has_DMN_LAYER_OBJECT_FKIndex1` (`OBJECT_VAL_ID`), 128 128 KEY `GENERIC_LABELS_has_DMN_LAYER_OBJECT_FKIndex2` (`OBJECT_GEOM_ID`) 129 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 129 ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 130 130 131 131 -- generic_lines -- … … 134 134 `OBJECT_GEOMETRY` linestring NOT NULL, 135 135 PRIMARY KEY (`OBJECT_ID`) 136 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 136 ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 137 137 138 138 -- generic_notes -- … … 147 147 `ISFIXED` tinyint(1) DEFAULT '0', 148 148 PRIMARY KEY (`OBJECT_ID`) 149 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 149 ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 150 150 151 151 -- generic_pat -- … … 156 156 KEY `GENERIC_POINTS_has_DMN_LAYER_OBJECT_FKIndex1` (`OBJECT_VAL_ID`), 157 157 KEY `GENERIC_POINTS_has_DMN_LAYER_OBJECT_FKIndex2` (`OBJECT_GEOM_ID`) 158 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 158 ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 159 159 160 160 -- generic_points -- … … 163 163 `OBJECT_GEOMETRY` multipoint NOT NULL COMMENT 'Feature geometry', 164 164 PRIMARY KEY (`OBJECT_ID`) 165 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 165 ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 166 166 167 167 -- lang_def -- … … 170 170 `LANG_NAME` varchar(50) DEFAULT NULL, 171 171 PRIMARY KEY (`LANG_ID`) 172 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 172 ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 173 173 174 174 … … 187 187 `QUERIES_CODE` varchar(1000) DEFAULT NULL, 188 188 PRIMARY KEY (`QUERIES_ID`) 189 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 189 ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 190 190 191 191 INSERT INTO prj_queries VALUES(1,0,"Lines without attribution","SELECT o.OBJECT_ID FROM generic_lines AS o WHERE o.OBJECT_ID NOT IN (SELECT a.OBJECT_GEOM_ID FROM generic_aat AS a)"); … … 208 208 `PRJ_SNAP_TOLERENCE` int(11) NOT NULL DEFAULT '10', 209 209 PRIMARY KEY (`SETTING_DBK`) 210 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 211 212 213 INSERT INTO prj_settings VALUES(1,"Meters","No projection"," Combioula_complet",224,"/Users/lucien/DATA/PRJ/TOOLMAP2/projects/test_prjaout/export",0,"/Users/lucien/DATA/PRJ/TOOLMAP2/projects/test_prjaout/backups","CREALP",0);210 ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 211 212 213 INSERT INTO prj_settings VALUES(1,"Meters","No projection","Master",224,"",0,"","SWISSTOPO - CREALP", "", 0); 214 214 215 215 -- prj_snapping -- … … 218 218 `SNAPPING_TYPE` int(11) NOT NULL, 219 219 PRIMARY KEY (`TOC_ID`) 220 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 220 ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 221 221 222 222 -- prj_stats -- … … 229 229 `DATE_END` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, 230 230 PRIMARY KEY (`STAT_ID`) 231 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 231 ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 232 232 233 233 -- prj_toc -- … … 244 244 PRIMARY KEY (`CONTENT_ID`), 245 245 KEY `PRJ_TOC_FKIndex1` (`TYPE_CD`) 246 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 247 248 249 INSERT INTO prj_toc VALUES(1,0,"","Lines",1,0,1, 0);250 INSERT INTO prj_toc VALUES(2,1,"","Points",1,1,2, 0);251 INSERT INTO prj_toc VALUES(3,1,"","Labels",1,2,3, 0);252 INSERT INTO prj_toc VALUES(4,1,"","Notes",0,3,4, 0);253 INSERT INTO prj_toc VALUES(5,0,"","Frame",1,4,5, 0);246 ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 247 248 249 INSERT INTO prj_toc VALUES(1,0,"","Lines",1,0,1,"",0); 250 INSERT INTO prj_toc VALUES(2,1,"","Points",1,1,2,"",0); 251 INSERT INTO prj_toc VALUES(3,1,"","Labels",1,2,3,"",0); 252 INSERT INTO prj_toc VALUES(4,1,"","Notes",0,3,4,"",0); 253 INSERT INTO prj_toc VALUES(5,0,"","Frame",1,4,5,"",0); 254 254 255 255 … … 261 261 KEY `SHORTCUT_KEYS_has_DMN_LAYER_OBJECT_FKIndex2` (`OBJECT_ID`), 262 262 KEY `SHORTCUT_LIST_FKIndex2` (`SHORTCUT_CD`) 263 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 263 ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 264 264 265 265 -- thematic_layers -- … … 272 272 PRIMARY KEY (`LAYER_INDEX`), 273 273 KEY `THEMATIC_LAYERS_FKIndex1` (`TYPE_CD`) 274 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 274 ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 275 275 276 276 -- zoom_level -- … … 280 280 `RANK` int(11) DEFAULT NULL, 281 281 PRIMARY KEY (`ZOOM_ID`) 282 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 282 ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 283 283 284 284 INSERT INTO zoom_level VALUES(1,5000,2); -
trunk/models/combioula/user_structure.sql
r7 r18 9 9 PRIMARY KEY (`OBJECT_ID`), 10 10 KEY `LAYER_ATX_FKIndex1` (`OBJECT_ID`) 11 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 11 ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 12 12 13 13 -- layer_at2 -- … … 19 19 PRIMARY KEY (`OBJECT_ID`), 20 20 KEY `LAYER_ATX_FKIndex1` (`OBJECT_ID`) 21 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 21 ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 22 22 23 23 -- layer_at3 -- … … 29 29 PRIMARY KEY (`OBJECT_ID`), 30 30 KEY `LAYER_ATX_FKIndex1` (`OBJECT_ID`) 31 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 31 ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 32 32 33 33 -- layer_at4 -- … … 39 39 PRIMARY KEY (`OBJECT_ID`), 40 40 KEY `LAYER_ATX_FKIndex1` (`OBJECT_ID`) 41 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 41 ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 42 42 43 43 -- layer_at7 -- … … 49 49 PRIMARY KEY (`OBJECT_ID`), 50 50 KEY `LAYER_ATX_FKIndex1` (`OBJECT_ID`) 51 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 51 ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 52 52 53 53 -- layer_at9 -- … … 57 57 PRIMARY KEY (`OBJECT_ID`), 58 58 KEY `LAYER_ATX_FKIndex1` (`OBJECT_ID`) 59 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 59 ) ENGINE=MyISAM DEFAULT CHARSET=utf8; 60 60 -
trunk/tmdmcreator/src/main.cpp
r16 r18 83 83 bool bVerbose = parser.Found("verbose"); 84 84 bool bToolMap = parser.Found("toolmap"); 85 if (parser.Found("overwrite") ) {85 if (parser.Found("overwrite") && wxFileExists(parser.GetParam(3))) { 86 86 wxRemoveFile(parser.GetParam(3)); 87 87 } -
trunk/tmdmcreator/src/tmdmcopier.cpp
r16 r18 26 26 27 27 TmDmCopier::~TmDmCopier() { 28 m_File->Flush(); 28 29 wxDELETE(m_File); 29 30 } … … 49 50 50 51 bool TmDmCopier::CopyFrom(const wxString & text) { 52 m_File->SeekEnd(); 51 53 if (m_File->Write(text) == false) { 52 54 m_Errors.Add(wxString::Format(_("Writing to: %s failed!"), m_File->GetName())); -
trunk/tmdmcreator/src/tmdmcreator.cpp
r17 r18 94 94 errorsmsg.Clear(); 95 95 // Copy structure 96 TmDmCopier myCopier(m_FileNameOutSQL); 97 if (myCopier.CopyFrom(m_FileNameBaseSQL) == false) { 98 errorsmsg.Add(wxString::Format(_("Copying: %s failed!"), m_FileNameBaseSQL.GetFullPath())); 99 return false; 96 { // needed to destroy the copier before processing layers 97 TmDmCopier myCopier(m_FileNameOutSQL); 98 if (myCopier.CopyFrom(m_FileNameBaseSQL) == false) { 99 errorsmsg.Add(wxString::Format(_("Copying: %s failed!"), m_FileNameBaseSQL.GetFullPath())); 100 return false; 101 } 102 103 if (myCopier.CopyFrom(m_FileNameUserSQL) == false) { 104 errorsmsg.Add(wxString::Format(_("Copying: %s failed!"), m_FileNameUserSQL.GetFullPath())); 105 return false; 106 } 100 107 } 101 102 if (myCopier.CopyFrom(m_FileNameUserSQL) == false) { 103 errorsmsg.Add(wxString::Format(_("Copying: %s failed!"), m_FileNameUserSQL.GetFullPath())); 104 return false; 105 } 106 108 107 109 // Process layers 108 110 TmDmProcessorSimple myLayerProc(m_FileNameUserContent, m_FileNameOutSQL); … … 112 114 return false; 113 115 } 114 if (myLayerProc.ProcessBlock(myThematicLayersStart )==false) {116 if (myLayerProc.ProcessBlock(myThematicLayersStart, _T("thematic_layers"))==false) { 115 117 errorsmsg.Add(wxString::Format(_("Processing 'thematic_layers' failed in %s"), m_FileNameUserContent.GetFullPath())); 116 118 return false; -
trunk/tmdmcreator/src/tmdmprocessor.cpp
r17 r18 61 61 62 62 63 bool TmDmProcessorSimple::ProcessBlock(int blockstart ) {64 wx String mySQLCols = wxEmptyString;65 wxString mySQLTxt = wxEmptyString;63 bool TmDmProcessorSimple::ProcessBlock(int blockstart, const wxString & tablename) { 64 wxArrayString mySQLCols; 65 TmDmCopier myCopier(m_FileDst); 66 66 67 67 wxFileInputStream input(m_FileSrc.GetFullPath()); … … 69 69 long myLineIndex = 0; 70 70 while(input.IsOk() && !input.Eof() ){ 71 wxString myRow = text.ReadLine(); 71 72 if (myLineIndex <= blockstart) { 72 73 myLineIndex++; … … 74 75 } 75 76 76 wxString myRow = text.ReadLine(); 77 if (myLineIndex == blockstart+1) { 78 mySQLCols = wxStringTokenize(myRow, _T("\t"), wxTOKEN_RET_EMPTY); 79 myLineIndex++; 80 continue; 81 } 77 82 78 // HERE !!! 83 wxArrayString myValues = wxStringTokenize(myRow, _T("\t"), wxTOKEN_RET_EMPTY_ALL); 84 bool bEmpty = true; 85 for (unsigned int i = 0; i< myValues.GetCount(); i++) { 86 if (myValues[i] != wxEmptyString) { 87 bEmpty = false; 88 break; 89 } 90 } 91 if (bEmpty == true) { 92 // ok empty line found 93 return true; 94 } 79 95 80 81 96 // write insert sentence 97 wxString myInsert = wxString::Format(_T("INSERT INTO `%s` ("), tablename); 98 for (unsigned int i = 0; i< mySQLCols.GetCount(); i++) { 99 myInsert.Append(wxString::Format(_T("%s,"), mySQLCols.Item(i))); 100 } 101 myInsert.RemoveLast(); 102 myInsert.Append(_T(") VALUES (")); 103 for (unsigned int i = 0; i< mySQLCols.GetCount(); i++) { 104 myInsert.Append(wxString::Format(_T("\"%s\","), myValues.Item(i))); 105 } 106 myInsert.RemoveLast(); 107 myInsert.Append(_T(");\n")); 108 myCopier.CopyFrom(myInsert); 82 109 myLineIndex++; 83 110 } 84 return wxNOT_FOUND;85 86 87 88 89 111 return false; 90 112 } … … 104 126 } 105 127 106 bool TmDmProcessorAttributs::ProcessBlock(int blockstart ) {128 bool TmDmProcessorAttributs::ProcessBlock(int blockstart, const wxString & tablename) { 107 129 return false; 108 130 } -
trunk/tmdmcreator/src/tmdmprocessor.h
r17 r18 24 24 #include <wx/wfstream.h> 25 25 #include <wx/txtstrm.h> 26 #include <wx/tokenzr.h> 26 27 27 28 … … 37 38 38 39 int FindBlock(const wxString & blockname); 39 virtual bool ProcessBlock(int blockstart ) = 0;40 virtual bool ProcessBlock(int blockstart, const wxString & tablename) = 0; 40 41 }; 41 42 … … 51 52 virtual ~TmDmProcessorSimple(); 52 53 53 virtual bool ProcessBlock(int blockstart );54 virtual bool ProcessBlock(int blockstart, const wxString & tablename); 54 55 }; 55 56 … … 65 66 virtual ~TmDmProcessorAttributs(); 66 67 67 virtual bool ProcessBlock(int blockstart );68 virtual bool ProcessBlock(int blockstart, const wxString & tablename); 68 69 }; 69 70 #endif
Note: See TracChangeset
for help on using the changeset viewer.