Changeset 31402 in osm for applications/editors/josm/plugins/OSMRecPlugin
- Timestamp:
- 2015-07-24T19:43:34+02:00 (9 years ago)
- Location:
- applications/editors/josm/plugins/OSMRecPlugin
- Files:
-
- 3 added
- 2 deleted
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/OSMRecPlugin/build.xml
r31106 r31402 25 25 <!--<property name="plugin.stage" value="..."/>--> 26 26 27 28 <!-- temporary out 27 29 <property name="josm" location="../../core/dist/josm-custom.jar"/> 28 30 <property name="plugin.dist.dir" value="../../dist"/> 29 31 --> 32 30 33 <!-- ** include targets that all plugins have in common ** --> 31 34 <!-- <import file="build-common.xml"/>--> -
applications/editors/josm/plugins/OSMRecPlugin/nbproject/private/private.xml
r31106 r31402 4 4 <open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2"> 5 5 <group> 6 <file>file:/home/imis-nkarag/software/josm /plugins/OSMRecPlugin/src/org/openstreetmap/josm/plugins/osmrec/MenuExportAction.java</file>7 <file>file:/home/imis-nkarag/software/josm /plugins/OSMRecPlugin/src/org/openstreetmap/josm/plugins/osmrec/OSMRecPlugin.java</file>6 <file>file:/home/imis-nkarag/software/josm_svn/josm/plugins/OSMRecPlugin/src/org/openstreetmap/josm/plugins/osmrec/OSMRecPlugin.java</file> 7 <file>file:/home/imis-nkarag/software/josm_svn/josm/plugins/OSMRecPlugin/src/org/openstreetmap/josm/plugins/osmrec/MenuExportAction.java</file> 8 8 </group> 9 9 </open-files> -
applications/editors/josm/plugins/OSMRecPlugin/nbproject/project.xml
r31106 r31402 81 81 <compilation-unit> 82 82 <package-root>src</package-root> 83 <classpath mode="compile">../../core/dist/josm-custom.jar:lib/l og4j-1.2.17.jar:lib/liblinear-java-1.95.jar:lib/jena-core-2.12.0.jar:lib/jts-1.13.jar:lib/gt-api-9.3.jar:lib/gt-referencing-9.3.jar:lib/gt-opengis-9.3.jar:lib/gt-metadata-9.3.jar:lib/slf4j-api-1.7.6.jar:lib/xercesImpl-2.11.0.jar:lib/commons-lang3-3.3.2.jar:lib/commons-pool-1.5.4.jar:lib/gt-api-9.3.jar:lib/gt-metadata-9.3.jar:lib/gt-opengis-9.3.jar:lib/gt-referencing-9.3.jar:lib/jai_core-1.1.3.jar:lib/jena-core-2.12.0.jar:lib/jena-iri-1.1.0.jar:lib/jgridshift-1.0.jar:lib/jsonic-1.2.7.jar:lib/jsr-275-1.0-beta-2.jar:lib/jts-1.13.jar:lib/langdetect-1.1-20120112.jar:lib/liblinear-1.95.jar:lib/liblinear-java-1.95.jar:lib/lucene-analyzers-3.6.0.jar:lib/lucene-core-3.6.0.jar:lib/slf4j-api-1.7.6.jar:lib/slf4j-log4j12-1.7.6.jar:lib/vecmath-1.3.2.jar:lib/xercesImpl-2.11.0.jar:lib/xml-apis-1.4.01.jar</classpath>83 <classpath mode="compile">../../core/dist/josm-custom.jar:lib/liblinear-java-1.95.jar:lib/jena-core-2.12.0.jar:lib/gt-api-9.3.jar:lib/gt-referencing-9.3.jar:lib/gt-opengis-9.3.jar:lib/gt-metadata-9.3.jar:lib/slf4j-api-1.7.6.jar:lib/xercesImpl-2.11.0.jar:lib/commons-lang3-3.3.2.jar:lib/commons-pool-1.5.4.jar:lib/gt-api-9.3.jar:lib/gt-metadata-9.3.jar:lib/gt-opengis-9.3.jar:lib/gt-referencing-9.3.jar:lib/jai_core-1.1.3.jar:lib/jena-core-2.12.0.jar:lib/jena-iri-1.1.0.jar:lib/jgridshift-1.0.jar:lib/jsonic-1.2.7.jar:lib/jsr-275-1.0-beta-2.jar:lib/langdetect-1.1-20120112.jar:lib/liblinear-1.95.jar:lib/liblinear-java-1.95.jar:lib/lucene-analyzers-3.6.0.jar:lib/lucene-core-3.6.0.jar:lib/slf4j-api-1.7.6.jar:lib/slf4j-log4j12-1.7.6.jar:lib/vecmath-1.3.2.jar:lib/xercesImpl-2.11.0.jar:lib/xml-apis-1.4.01.jar:lib/jts-1.13.jar</classpath> 84 84 <built-to>../../dist</built-to> 85 85 <source-level>1.7</source-level> -
applications/editors/josm/plugins/OSMRecPlugin/src/org/openstreetmap/josm/plugins/extractor/LanguageDetector.java
r31106 r31402 43 43 44 44 if(!new File(languageProfilesPath).exists()){ 45 new File(languageProfilesPath).mkdir(); 45 //new File(languageProfilesPath).mkdir(); 46 new File(languageProfilesPath).mkdirs(); 46 47 } 47 File languageProfilesOutputFile1 = new File(languageProfilesPath + "/el"); 48 File languageProfilesOutputFile1 = new File(languageProfilesPath + "/el"); 48 49 File languageProfilesOutputFile2 = new File(languageProfilesPath +"/en"); 50 51 try { 52 System.out.println("languageProfilesOutputFile1.exists: " + languageProfilesOutputFile1.exists()); 53 System.out.println("languageProfilesOutputFile1.getAbsolutePath(): " + languageProfilesOutputFile1.getAbsolutePath()); 54 System.out.println("languageProfilesOutputFile1.canRead(): " + languageProfilesOutputFile1.canRead()); 55 System.out.println("languageProfilesOutputFile1.canWrite(): " + languageProfilesOutputFile1.canWrite()); 56 //System.out.println("languageProfilesOutputFile1.canRead(): " + languageProfilesOutputFile1.); 57 58 languageProfilesOutputFile1.createNewFile(); 59 languageProfilesOutputFile2.createNewFile(); 60 } catch (IOException ex) { 61 Logger.getLogger(LanguageDetector.class.getName()).log(Level.SEVERE, null, ex); 62 } 63 49 64 //languageProfilesOutputFile.mkdirs(); 50 65 … … 57 72 Logger.getLogger(LanguageDetector.class.getName()).log(Level.SEVERE, null, ex); 58 73 } 59 System.out.println("deb1");74 //System.out.println("deb1"); 60 75 61 76 FileOutputStream outputStream2 = null; -
applications/editors/josm/plugins/OSMRecPlugin/src/org/openstreetmap/josm/plugins/extractor/TextualListLoader.java
r31106 r31402 8 8 import java.util.logging.Level; 9 9 import java.util.logging.Logger; 10 //import org.apache.log4j.Logger; 10 11 11 12 /** … … 18 19 public class TextualListLoader { 19 20 20 private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(TextualListLoader.class); 21 //private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(TextualListLoader.class); 22 //private static final Logger LOG = Logger.getLogger(TextualListLoader.class); 21 23 private List<String> namesList; 22 24 … … 36 38 namesList.add(nextLine); 37 39 } 38 LOG.info("Name occurences parsed successfully!");40 //LOG.info("Name occurences parsed successfully!"); 39 41 } 40 42 -
applications/editors/josm/plugins/OSMRecPlugin/src/org/openstreetmap/josm/plugins/osmrec/OSMRecPluginHelper.java
r31108 r31402 126 126 import org.openstreetmap.josm.plugins.core.TrainWorker; 127 127 import org.openstreetmap.josm.plugins.extractor.LanguageDetector; 128 import org.openstreetmap.josm.plugins.extractor.SampleModelsExtractor; 128 129 import org.openstreetmap.josm.plugins.features.ClassFeatures; 129 130 import org.openstreetmap.josm.plugins.features.GeometryFeatures; … … 159 160 private static String MODEL_PATH; 160 161 private static String TEXTUAL_LIST_PATH; 161 162 private static Map<String, List<String>> indirectClasses; 163 private static Map<String, Integer> indirectClassesWithIDs; 164 private static LanguageDetector languageDetector; 165 private static String bestModelPath; 166 private final String modelWithClassesPath; 167 168 162 169 // Selection that we are editing by using both dialogs 163 170 Collection<OsmPrimitive> sel; … … 186 193 } 187 194 }; 195 188 196 189 private static Map<String, List<String>> indirectClasses;190 private static Map<String, Integer> indirectClassesWithIDs;191 private static LanguageDetector languageDetector;192 193 197 OSMRecPluginHelper(DefaultTableModel propertyData, Map<String, Map<String, Integer>> valueCount) { 194 198 this.tagData = propertyData; … … 203 207 MODEL_PATH = new File(MAIN_PATH).getParentFile() + "/OSMRec_models"; 204 208 TEXTUAL_LIST_PATH = MODEL_PATH + "/textualList.txt"; 209 bestModelPath = MODEL_PATH + "/best_model"; 210 modelWithClassesPath = MODEL_PATH + "/model_with_classes"; 205 211 languageDetector = LanguageDetector.getInstance(MODEL_PATH + "/profiles"); 212 213 SampleModelsExtractor sa = new SampleModelsExtractor(); 214 215 sa.extractSampleSVMmodel("best_model", bestModelPath); 216 sa.extractSampleSVMmodel("model_with_classes", modelWithClassesPath); 217 206 218 } 207 219 … … 1483 1495 configureContextsensitiveHelp("/Dialog/AddValue", true /* show help button */); 1484 1496 final AddTagsDialog lala = this; 1497 1485 1498 1486 1499 loadOntology(); … … 1497 1510 } 1498 1511 1499 1512 //if training process has not been performed, we use two sample SVM models, extracted from the jar 1513 //File bestModelFile = new File(bestModelPath); 1514 //File bestModelWithClassesFile = new File(modelWithClassesPath); 1500 1515 1501 1516 JPanel splitPanel = new JPanel(new BorderLayout(10,10)); … … 1629 1644 //get a simple selection 1630 1645 if(!osmPrimitiveSelection.isEmpty()){ 1631 s = osmPrimitiveSelection.get(0); 1632 if(s.getInterestingTags().isEmpty()){ 1646 s = osmPrimitiveSelection.get(0); 1647 File modelDirectory = new File(MODEL_PATH); 1648 String modelWithClassesPath = modelDirectory.getAbsolutePath() + "/model_with_classes"; 1649 File modelWithClassesFile = new File(modelWithClassesPath); 1650 if(s.getInterestingTags().isEmpty() || !modelWithClassesFile.exists()){ 1633 1651 loadSVMmodel(false);//load original model 1634 1652 createOSMObject(sel, false); //create object without class features … … 1650 1668 public void valueChanged(ListSelectionEvent listSelectionEvent) { 1651 1669 if (!listSelectionEvent.getValueIsAdjusting()) {//This prevents double events 1652 System.out.println("tag selected: " + categoryList.getSelectedValue());1670 //System.out.println("tag selected: " + categoryList.getSelectedValue()); 1653 1671 1654 1672 String selectedClass = categoryList.getSelectedValue(); … … 2094 2112 2095 2113 mapLabelsToIDs.put(modelSVMLabels[h], h); 2096 System.out.println(h + " <-> " + modelSVMLabels[h]);2114 //System.out.println(h + " <-> " + modelSVMLabels[h]); 2097 2115 2098 2116 } … … 2211 2229 } 2212 2230 } 2213 System.out.println("final list:" + scoreMap);2231 //System.out.println("final list:" + scoreMap); 2214 2232 } 2215 2233 } -
applications/editors/josm/plugins/OSMRecPlugin/src/org/openstreetmap/josm/plugins/parsers/Mapper.java
r31106 r31402 4 4 import java.io.FileNotFoundException; 5 5 import java.io.InputStream; 6 import java.util.Collections; 6 7 import java.util.HashMap; 8 import java.util.LinkedHashMap; 7 9 import java.util.Map; 8 10 import java.util.Scanner; … … 17 19 18 20 public class Mapper { 19 private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(Mapper.class);21 //private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(Mapper.class); 20 22 private final HashMap<String, String> mappings; 21 23 private final HashMap<String, Integer> mappingsWithIDs; … … 23 25 public Mapper(){ 24 26 25 mappings = new HashMap<>();27 mappings = new LinkedHashMap<>(); 26 28 mappingsWithIDs = new HashMap<>(); 27 29 … … 45 47 } 46 48 constructMappingsWithIDs(); 47 48 LOG.info("Mappings file parsed successfully!");49 System.out.println("Mappings file parsed successfully!"); 50 //LOG.info("Mappings file parsed successfully!"); 49 51 } 50 52 … … 58 60 59 61 public Map<String,Integer> getMappingsWithIDs(){ 60 return this.mappingsWithIDs;62 return Collections.unmodifiableMap(mappingsWithIDs); 61 63 } 62 64 63 65 public Map<String,String> getMappings(){ 64 return this.mappings;66 return Collections.unmodifiableMap(mappings); 65 67 } 66 68 } -
applications/editors/josm/plugins/OSMRecPlugin/src/org/openstreetmap/josm/plugins/parsers/Ontology.java
r31106 r31402 50 50 ontologyModel = ModelFactory.createOntologyModel(); 51 51 52 org.apache.log4j.Logger.getRootLogger().setLevel(org.apache.log4j.Level.ERROR);52 //org.apache.log4j.Logger.getRootLogger().setLevel(org.apache.log4j.Level.ERROR); 53 53 ontologyModel.read(owlFile, null); //Hide RDFDefaultErrorHandler from terminal to keep clear output. 54 org.apache.log4j.Logger.getRootLogger().setLevel(org.apache.log4j.Level.INFO);54 //org.apache.log4j.Logger.getRootLogger().setLevel(org.apache.log4j.Level.INFO); 55 55 56 56 listHierarchy = ontologyModel.listHierarchyRootClasses().toList(); 57 57 setListHierarchy(listHierarchy); 58 58 59 ExtendedIterator classes = ontologyModel.listClasses();59 ExtendedIterator<OntClass> classes = ontologyModel.listClasses(); 60 60 while (classes.hasNext()) { 61 61 String className; 62 OntClass obj = (OntClass)classes.next();62 OntClass obj = classes.next(); 63 63 64 64 //compare localname with class name from map and call getSuperclass -
applications/editors/josm/plugins/OSMRecPlugin/src/org/openstreetmap/josm/plugins/parsers/TextualStatistics.java
r31106 r31402 3 3 import java.io.InputStream; 4 4 import java.util.ArrayList; 5 import java.util.Collections; 5 6 import java.util.List; 6 7 import java.util.Scanner; … … 30 31 31 32 public List<String> getTextualList(){ 32 return textualList;33 return Collections.unmodifiableList(textualList); 33 34 } 34 35 }
Note:
See TracChangeset
for help on using the changeset viewer.