commit
cab3646fcd
21 changed files with 1047 additions and 0 deletions
@ -0,0 +1,40 @@ |
|||||||
|
target/ |
||||||
|
!.mvn/wrapper/maven-wrapper.jar |
||||||
|
!**/src/main/**/target/ |
||||||
|
!**/src/test/**/target/ |
||||||
|
|
||||||
|
### IntelliJ IDEA ### |
||||||
|
.idea/modules.xml |
||||||
|
.idea/jarRepositories.xml |
||||||
|
.idea/compiler.xml |
||||||
|
.idea/libraries/ |
||||||
|
*.iws |
||||||
|
*.iml |
||||||
|
*.ipr |
||||||
|
|
||||||
|
### Eclipse ### |
||||||
|
.apt_generated |
||||||
|
.classpath |
||||||
|
.factorypath |
||||||
|
.project |
||||||
|
.settings |
||||||
|
.springBeans |
||||||
|
.sts4-cache |
||||||
|
|
||||||
|
### NetBeans ### |
||||||
|
/nbproject/private/ |
||||||
|
/nbbuild/ |
||||||
|
/dist/ |
||||||
|
/nbdist/ |
||||||
|
/.nb-gradle/ |
||||||
|
build/ |
||||||
|
!**/src/main/**/build/ |
||||||
|
!**/src/test/**/build/ |
||||||
|
|
||||||
|
### VS Code ### |
||||||
|
.vscode/ |
||||||
|
|
||||||
|
### Mac OS ### |
||||||
|
.DS_Store |
||||||
|
ri_log |
||||||
|
action.xml |
||||||
@ -0,0 +1,11 @@ |
|||||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||||
|
<project version="4"> |
||||||
|
<component name="accountSettings"> |
||||||
|
<option name="activeRegion" value="us-east-1" /> |
||||||
|
<option name="recentlyUsedRegions"> |
||||||
|
<list> |
||||||
|
<option value="us-east-1" /> |
||||||
|
</list> |
||||||
|
</option> |
||||||
|
</component> |
||||||
|
</project> |
||||||
@ -0,0 +1,14 @@ |
|||||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||||
|
<project version="4"> |
||||||
|
<component name="ExternalStorageConfigurationManager" enabled="true" /> |
||||||
|
<component name="MavenProjectsManager"> |
||||||
|
<option name="originalFiles"> |
||||||
|
<list> |
||||||
|
<option value="$PROJECT_DIR$/pom.xml" /> |
||||||
|
</list> |
||||||
|
</option> |
||||||
|
</component> |
||||||
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_18" default="true" project-jdk-name="openjdk-18" project-jdk-type="JavaSDK"> |
||||||
|
<output url="file://$PROJECT_DIR$/out" /> |
||||||
|
</component> |
||||||
|
</project> |
||||||
@ -0,0 +1,124 @@ |
|||||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||||
|
<project version="4"> |
||||||
|
<component name="Palette2"> |
||||||
|
<group name="Swing"> |
||||||
|
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false"> |
||||||
|
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" /> |
||||||
|
</item> |
||||||
|
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false"> |
||||||
|
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" /> |
||||||
|
</item> |
||||||
|
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.svg" removable="false" auto-create-binding="false" can-attach-label="false"> |
||||||
|
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" /> |
||||||
|
</item> |
||||||
|
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.svg" removable="false" auto-create-binding="false" can-attach-label="true"> |
||||||
|
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" /> |
||||||
|
</item> |
||||||
|
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.svg" removable="false" auto-create-binding="true" can-attach-label="false"> |
||||||
|
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" /> |
||||||
|
<initial-values> |
||||||
|
<property name="text" value="Button" /> |
||||||
|
</initial-values> |
||||||
|
</item> |
||||||
|
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.svg" removable="false" auto-create-binding="true" can-attach-label="false"> |
||||||
|
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" /> |
||||||
|
<initial-values> |
||||||
|
<property name="text" value="RadioButton" /> |
||||||
|
</initial-values> |
||||||
|
</item> |
||||||
|
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.svg" removable="false" auto-create-binding="true" can-attach-label="false"> |
||||||
|
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" /> |
||||||
|
<initial-values> |
||||||
|
<property name="text" value="CheckBox" /> |
||||||
|
</initial-values> |
||||||
|
</item> |
||||||
|
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.svg" removable="false" auto-create-binding="false" can-attach-label="false"> |
||||||
|
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" /> |
||||||
|
<initial-values> |
||||||
|
<property name="text" value="Label" /> |
||||||
|
</initial-values> |
||||||
|
</item> |
||||||
|
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.svg" removable="false" auto-create-binding="true" can-attach-label="true"> |
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1"> |
||||||
|
<preferred-size width="150" height="-1" /> |
||||||
|
</default-constraints> |
||||||
|
</item> |
||||||
|
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.svg" removable="false" auto-create-binding="true" can-attach-label="true"> |
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1"> |
||||||
|
<preferred-size width="150" height="-1" /> |
||||||
|
</default-constraints> |
||||||
|
</item> |
||||||
|
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.svg" removable="false" auto-create-binding="true" can-attach-label="true"> |
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1"> |
||||||
|
<preferred-size width="150" height="-1" /> |
||||||
|
</default-constraints> |
||||||
|
</item> |
||||||
|
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.svg" removable="false" auto-create-binding="true" can-attach-label="true"> |
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3"> |
||||||
|
<preferred-size width="150" height="50" /> |
||||||
|
</default-constraints> |
||||||
|
</item> |
||||||
|
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.svg" removable="false" auto-create-binding="true" can-attach-label="true"> |
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3"> |
||||||
|
<preferred-size width="150" height="50" /> |
||||||
|
</default-constraints> |
||||||
|
</item> |
||||||
|
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.svg" removable="false" auto-create-binding="true" can-attach-label="true"> |
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3"> |
||||||
|
<preferred-size width="150" height="50" /> |
||||||
|
</default-constraints> |
||||||
|
</item> |
||||||
|
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.svg" removable="false" auto-create-binding="true" can-attach-label="true"> |
||||||
|
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" /> |
||||||
|
</item> |
||||||
|
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.svg" removable="false" auto-create-binding="true" can-attach-label="false"> |
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3"> |
||||||
|
<preferred-size width="150" height="50" /> |
||||||
|
</default-constraints> |
||||||
|
</item> |
||||||
|
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.svg" removable="false" auto-create-binding="true" can-attach-label="false"> |
||||||
|
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3"> |
||||||
|
<preferred-size width="150" height="50" /> |
||||||
|
</default-constraints> |
||||||
|
</item> |
||||||
|
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.svg" removable="false" auto-create-binding="true" can-attach-label="false"> |
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3"> |
||||||
|
<preferred-size width="150" height="50" /> |
||||||
|
</default-constraints> |
||||||
|
</item> |
||||||
|
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.svg" removable="false" auto-create-binding="true" can-attach-label="false"> |
||||||
|
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3"> |
||||||
|
<preferred-size width="200" height="200" /> |
||||||
|
</default-constraints> |
||||||
|
</item> |
||||||
|
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.svg" removable="false" auto-create-binding="false" can-attach-label="false"> |
||||||
|
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3"> |
||||||
|
<preferred-size width="200" height="200" /> |
||||||
|
</default-constraints> |
||||||
|
</item> |
||||||
|
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.svg" removable="false" auto-create-binding="true" can-attach-label="true"> |
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" /> |
||||||
|
</item> |
||||||
|
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.svg" removable="false" auto-create-binding="true" can-attach-label="false"> |
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" /> |
||||||
|
</item> |
||||||
|
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.svg" removable="false" auto-create-binding="false" can-attach-label="false"> |
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" /> |
||||||
|
</item> |
||||||
|
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.svg" removable="false" auto-create-binding="true" can-attach-label="false"> |
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" /> |
||||||
|
</item> |
||||||
|
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.svg" removable="false" auto-create-binding="false" can-attach-label="false"> |
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1"> |
||||||
|
<preferred-size width="-1" height="20" /> |
||||||
|
</default-constraints> |
||||||
|
</item> |
||||||
|
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.svg" removable="false" auto-create-binding="false" can-attach-label="false"> |
||||||
|
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" /> |
||||||
|
</item> |
||||||
|
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.svg" removable="false" auto-create-binding="true" can-attach-label="false"> |
||||||
|
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" /> |
||||||
|
</item> |
||||||
|
</group> |
||||||
|
</component> |
||||||
|
</project> |
||||||
@ -0,0 +1,6 @@ |
|||||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||||
|
<project version="4"> |
||||||
|
<component name="VcsDirectoryMappings"> |
||||||
|
<mapping directory="$PROJECT_DIR$" vcs="Git" /> |
||||||
|
</component> |
||||||
|
</project> |
||||||
@ -0,0 +1,193 @@ |
|||||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||||
|
<project version="4"> |
||||||
|
<component name="AutoImportSettings"> |
||||||
|
<option name="autoReloadType" value="SELECTIVE" /> |
||||||
|
</component> |
||||||
|
<component name="ChangeListManager"> |
||||||
|
<list default="true" id="aada2b3d-ba01-45e9-89c7-a596447b137a" name="Changes" comment=""> |
||||||
|
<change afterPath="$PROJECT_DIR$/.gitignore" afterDir="false" /> |
||||||
|
<change afterPath="$PROJECT_DIR$/.idea/aws.xml" afterDir="false" /> |
||||||
|
<change afterPath="$PROJECT_DIR$/.idea/misc.xml" afterDir="false" /> |
||||||
|
<change afterPath="$PROJECT_DIR$/.idea/uiDesigner.xml" afterDir="false" /> |
||||||
|
<change afterPath="$PROJECT_DIR$/.idea/vcs.xml" afterDir="false" /> |
||||||
|
<change afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> |
||||||
|
<change afterPath="$PROJECT_DIR$/action.xml" afterDir="false" /> |
||||||
|
<change afterPath="$PROJECT_DIR$/pom.xml" afterDir="false" /> |
||||||
|
<change afterPath="$PROJECT_DIR$/src/main/java/org/leolo/map/osm/extract/Constants.java" afterDir="false" /> |
||||||
|
<change afterPath="$PROJECT_DIR$/src/main/java/org/leolo/map/osm/extract/ExtractElement.java" afterDir="false" /> |
||||||
|
<change afterPath="$PROJECT_DIR$/src/main/java/org/leolo/map/osm/extract/FormatterManager.java" afterDir="false" /> |
||||||
|
<change afterPath="$PROJECT_DIR$/src/main/java/org/leolo/map/osm/extract/OutputFormat.java" afterDir="false" /> |
||||||
|
<change afterPath="$PROJECT_DIR$/src/main/java/org/leolo/map/osm/extract/OutputFormatter.java" afterDir="false" /> |
||||||
|
<change afterPath="$PROJECT_DIR$/src/main/java/org/leolo/map/osm/extract/format/KMLFormatter.java" afterDir="false" /> |
||||||
|
<change afterPath="$PROJECT_DIR$/src/main/java/org/leolo/map/osm/extract/format/PlainFormatter.java" afterDir="false" /> |
||||||
|
<change afterPath="$PROJECT_DIR$/src/main/java/org/leolo/map/osm/extract/model/ActionFile.java" afterDir="false" /> |
||||||
|
<change afterPath="$PROJECT_DIR$/src/main/java/org/leolo/map/osm/extract/model/ExtractItem.java" afterDir="false" /> |
||||||
|
<change afterPath="$PROJECT_DIR$/src/main/java/org/leolo/map/osm/extract/model/MapEntry.java" afterDir="false" /> |
||||||
|
<change afterPath="$PROJECT_DIR$/src/main/java/org/leolo/map/osm/extract/model/Node.java" afterDir="false" /> |
||||||
|
<change afterPath="$PROJECT_DIR$/src/main/java/org/leolo/map/osm/extract/model/Relation.java" afterDir="false" /> |
||||||
|
<change afterPath="$PROJECT_DIR$/src/main/java/org/leolo/map/osm/extract/model/Way.java" afterDir="false" /> |
||||||
|
<change afterPath="$PROJECT_DIR$/src/main/resources/log4j2.xml" afterDir="false" /> |
||||||
|
</list> |
||||||
|
<option name="SHOW_DIALOG" value="false" /> |
||||||
|
<option name="HIGHLIGHT_CONFLICTS" value="true" /> |
||||||
|
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" /> |
||||||
|
<option name="LAST_RESOLUTION" value="IGNORE" /> |
||||||
|
</component> |
||||||
|
<component name="FileTemplateManagerImpl"> |
||||||
|
<option name="RECENT_TEMPLATES"> |
||||||
|
<list> |
||||||
|
<option value="AnnotationType" /> |
||||||
|
<option value="Interface" /> |
||||||
|
<option value="Class" /> |
||||||
|
</list> |
||||||
|
</option> |
||||||
|
</component> |
||||||
|
<component name="Git.Settings"> |
||||||
|
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" /> |
||||||
|
</component> |
||||||
|
<component name="MarkdownSettingsMigration"> |
||||||
|
<option name="stateVersion" value="1" /> |
||||||
|
</component> |
||||||
|
<component name="ProjectId" id="2Eykj2SggZ4KtR6OJyjcndHtTWt" /> |
||||||
|
<component name="ProjectLevelVcsManager" settingsEditedManually="true" /> |
||||||
|
<component name="ProjectViewState"> |
||||||
|
<option name="hideEmptyMiddlePackages" value="true" /> |
||||||
|
<option name="showLibraryContents" value="true" /> |
||||||
|
</component> |
||||||
|
<component name="PropertiesComponent"><![CDATA[{ |
||||||
|
"keyToString": { |
||||||
|
"RunOnceActivity.OpenProjectViewOnStart": "true", |
||||||
|
"RunOnceActivity.ShowReadmeOnStart": "true", |
||||||
|
"SHARE_PROJECT_CONFIGURATION_FILES": "true", |
||||||
|
"WebServerToolWindowFactoryState": "false" |
||||||
|
} |
||||||
|
}]]></component> |
||||||
|
<component name="RecentsManager"> |
||||||
|
<key name="CreateClassDialog.RecentsKey"> |
||||||
|
<recent name="org.leolo.map.osm.extract.model" /> |
||||||
|
</key> |
||||||
|
<key name="MoveFile.RECENT_KEYS"> |
||||||
|
<recent name="D:\IdeaProjects\OSM extract" /> |
||||||
|
<recent name="D:\IdeaProjects\OSM extract\src\main\resources" /> |
||||||
|
</key> |
||||||
|
<key name="MoveClassesOrPackagesDialog.RECENTS_KEY"> |
||||||
|
<recent name="org.leolo.map.osm.extract.model" /> |
||||||
|
</key> |
||||||
|
</component> |
||||||
|
<component name="RunManager" selected="Application.Main"> |
||||||
|
<configuration name="Main" type="Application" factoryName="Application"> |
||||||
|
<option name="MAIN_CLASS_NAME" value="org.leolo.map.osm.extract.ExtractElement" /> |
||||||
|
<module name="OSM extract" /> |
||||||
|
<option name="PROGRAM_PARAMETERS" value="-d "D:\Downloads\isle-of-man-latest.osm.pbf" -a action.xml --format plain" /> |
||||||
|
<extension name="software.aws.toolkits.jetbrains.core.execution.JavaAwsConnectionExtension"> |
||||||
|
<option name="credential" /> |
||||||
|
<option name="region" /> |
||||||
|
<option name="useCurrentConnection" value="false" /> |
||||||
|
</extension> |
||||||
|
<method v="2"> |
||||||
|
<option name="Make" enabled="true" /> |
||||||
|
</method> |
||||||
|
</configuration> |
||||||
|
<configuration name="OSM-extract [clean,compile]" type="MavenRunConfiguration" factoryName="Maven" nameIsGenerated="true"> |
||||||
|
<MavenSettings> |
||||||
|
<option name="myGeneralSettings" /> |
||||||
|
<option name="myRunnerSettings" /> |
||||||
|
<option name="myRunnerParameters"> |
||||||
|
<MavenRunnerParameters> |
||||||
|
<option name="profiles"> |
||||||
|
<set /> |
||||||
|
</option> |
||||||
|
<option name="goals"> |
||||||
|
<list> |
||||||
|
<option value="clean" /> |
||||||
|
<option value="compile" /> |
||||||
|
</list> |
||||||
|
</option> |
||||||
|
<option name="pomFileName" /> |
||||||
|
<option name="profilesMap"> |
||||||
|
<map /> |
||||||
|
</option> |
||||||
|
<option name="resolveToWorkspace" value="false" /> |
||||||
|
<option name="workingDirPath" value="$PROJECT_DIR$" /> |
||||||
|
</MavenRunnerParameters> |
||||||
|
</option> |
||||||
|
</MavenSettings> |
||||||
|
<extension name="software.aws.toolkits.jetbrains.core.execution.JavaAwsConnectionExtension"> |
||||||
|
<option name="credential" /> |
||||||
|
<option name="region" /> |
||||||
|
<option name="useCurrentConnection" value="false" /> |
||||||
|
</extension> |
||||||
|
<method v="2" /> |
||||||
|
</configuration> |
||||||
|
<configuration name="OSM-extract [clean,compile,test]" type="MavenRunConfiguration" factoryName="Maven" nameIsGenerated="true"> |
||||||
|
<MavenSettings> |
||||||
|
<option name="myGeneralSettings" /> |
||||||
|
<option name="myRunnerSettings" /> |
||||||
|
<option name="myRunnerParameters"> |
||||||
|
<MavenRunnerParameters> |
||||||
|
<option name="profiles"> |
||||||
|
<set /> |
||||||
|
</option> |
||||||
|
<option name="goals"> |
||||||
|
<list> |
||||||
|
<option value="clean" /> |
||||||
|
<option value="compile" /> |
||||||
|
<option value="test" /> |
||||||
|
</list> |
||||||
|
</option> |
||||||
|
<option name="pomFileName" /> |
||||||
|
<option name="profilesMap"> |
||||||
|
<map /> |
||||||
|
</option> |
||||||
|
<option name="resolveToWorkspace" value="false" /> |
||||||
|
<option name="workingDirPath" value="$PROJECT_DIR$" /> |
||||||
|
</MavenRunnerParameters> |
||||||
|
</option> |
||||||
|
</MavenSettings> |
||||||
|
<extension name="software.aws.toolkits.jetbrains.core.execution.JavaAwsConnectionExtension"> |
||||||
|
<option name="credential" /> |
||||||
|
<option name="region" /> |
||||||
|
<option name="useCurrentConnection" value="false" /> |
||||||
|
</extension> |
||||||
|
<method v="2" /> |
||||||
|
</configuration> |
||||||
|
<list> |
||||||
|
<item itemvalue="Application.Main" /> |
||||||
|
<item itemvalue="Maven.OSM-extract [clean,compile,test]" /> |
||||||
|
<item itemvalue="Maven.OSM-extract [clean,compile]" /> |
||||||
|
</list> |
||||||
|
</component> |
||||||
|
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" /> |
||||||
|
<component name="TaskManager"> |
||||||
|
<task active="true" id="Default" summary="Default task"> |
||||||
|
<changelist id="aada2b3d-ba01-45e9-89c7-a596447b137a" name="Changes" comment="" /> |
||||||
|
<created>1663575347472</created> |
||||||
|
<option name="number" value="Default" /> |
||||||
|
<option name="presentableId" value="Default" /> |
||||||
|
<updated>1663575347472</updated> |
||||||
|
<workItem from="1663575350840" duration="40887000" /> |
||||||
|
</task> |
||||||
|
<servers /> |
||||||
|
</component> |
||||||
|
<component name="TypeScriptGeneratedFilesManager"> |
||||||
|
<option name="version" value="3" /> |
||||||
|
</component> |
||||||
|
<component name="Vcs.Log.Tabs.Properties"> |
||||||
|
<option name="TAB_STATES"> |
||||||
|
<map> |
||||||
|
<entry key="MAIN"> |
||||||
|
<value> |
||||||
|
<State /> |
||||||
|
</value> |
||||||
|
</entry> |
||||||
|
</map> |
||||||
|
</option> |
||||||
|
</component> |
||||||
|
<component name="XDebuggerManager"> |
||||||
|
<watches-manager> |
||||||
|
<configuration name="Application"> |
||||||
|
<watch expression="((Long)((Hashtable.Entry)((Hashtable)((ExtractElement)this).allEntry).entrySet().toArray()[1]).getKey()).value" custom="java.lang.Long,org.leolo.map.osm.extract.ExtractElement,java.util.Hashtable.Entry,java.util.Hashtable" /> |
||||||
|
</configuration> |
||||||
|
</watches-manager> |
||||||
|
</component> |
||||||
|
</project> |
||||||
@ -0,0 +1,39 @@ |
|||||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" |
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
||||||
|
<modelVersion>4.0.0</modelVersion> |
||||||
|
|
||||||
|
<groupId>org.leolo</groupId> |
||||||
|
<artifactId>OSM-extract</artifactId> |
||||||
|
<version>1.0-SNAPSHOT</version> |
||||||
|
|
||||||
|
<properties> |
||||||
|
<maven.compiler.source>18</maven.compiler.source> |
||||||
|
<maven.compiler.target>18</maven.compiler.target> |
||||||
|
<gpf-ver>3.21.6</gpf-ver> |
||||||
|
</properties> |
||||||
|
<dependencies> |
||||||
|
<dependency> |
||||||
|
<groupId>org.apache.logging.log4j</groupId> |
||||||
|
<artifactId>log4j-core</artifactId> |
||||||
|
<version>2.18.0</version> |
||||||
|
</dependency> |
||||||
|
<dependency> |
||||||
|
<groupId>commons-cli</groupId> |
||||||
|
<artifactId>commons-cli</artifactId> |
||||||
|
<version>1.5.0</version> |
||||||
|
</dependency> |
||||||
|
<dependency> |
||||||
|
<groupId>eu.infomas</groupId> |
||||||
|
<artifactId>annotation-detector</artifactId> |
||||||
|
<version>3.0.5</version> |
||||||
|
</dependency> |
||||||
|
<dependency> |
||||||
|
<groupId>org.openstreetmap.pbf</groupId> |
||||||
|
<artifactId>osmpbf</artifactId> |
||||||
|
<version>1.5.0</version> |
||||||
|
</dependency> |
||||||
|
</dependencies> |
||||||
|
|
||||||
|
</project> |
||||||
@ -0,0 +1,7 @@ |
|||||||
|
package org.leolo.map.osm.extract; |
||||||
|
|
||||||
|
public class Constants { |
||||||
|
public class CLI{ |
||||||
|
// public static final String HELP = "help";
|
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,185 @@ |
|||||||
|
package org.leolo.map.osm.extract; |
||||||
|
|
||||||
|
import crosby.binary.BinaryParser; |
||||||
|
import crosby.binary.Osmformat; |
||||||
|
import crosby.binary.file.BlockInputStream; |
||||||
|
import org.apache.commons.cli.*; |
||||||
|
import org.apache.logging.log4j.LogManager; |
||||||
|
import org.apache.logging.log4j.Logger; |
||||||
|
import org.leolo.map.osm.extract.model.*; |
||||||
|
import org.xml.sax.SAXException; |
||||||
|
|
||||||
|
import javax.xml.parsers.ParserConfigurationException; |
||||||
|
import java.io.*; |
||||||
|
import java.util.*; |
||||||
|
import java.util.concurrent.*; |
||||||
|
|
||||||
|
public class ExtractElement { |
||||||
|
|
||||||
|
private Logger log = LogManager.getLogger(); |
||||||
|
private Options options; |
||||||
|
|
||||||
|
private class CliOpt{ |
||||||
|
Option help = Option.builder() |
||||||
|
.longOpt("help") |
||||||
|
.hasArg(false) |
||||||
|
.desc("Print this help message") |
||||||
|
.build(); |
||||||
|
Option dbFile = Option.builder() |
||||||
|
.longOpt("dbFile") |
||||||
|
.option("d") |
||||||
|
.required(true) |
||||||
|
.hasArg(true) |
||||||
|
.argName("pbf File") |
||||||
|
.desc("The PBF file from OSM") |
||||||
|
.build(); |
||||||
|
Option outputFile = Option.builder() |
||||||
|
.option("o") |
||||||
|
.longOpt("output") |
||||||
|
.argName("output file") |
||||||
|
.hasArg(true) |
||||||
|
.required(false) |
||||||
|
.desc("Output file") |
||||||
|
.build(); |
||||||
|
|
||||||
|
Option actionFile = Option.builder() |
||||||
|
.option("a") |
||||||
|
.longOpt("actionFile") |
||||||
|
.argName("action file") |
||||||
|
.hasArg(true) |
||||||
|
.required(true) |
||||||
|
.desc("Action files") |
||||||
|
.build(); |
||||||
|
Option outputFormat = Option.builder() |
||||||
|
.option("f") |
||||||
|
.longOpt("format") |
||||||
|
.argName("format") |
||||||
|
.hasArg(true) |
||||||
|
.required(true) |
||||||
|
.desc("output format") |
||||||
|
.build(); |
||||||
|
} |
||||||
|
|
||||||
|
private Map<Long, MapEntry> allEntry = new Hashtable<>(); |
||||||
|
private Map<Long, Relation> relations = new Hashtable<>(); |
||||||
|
private Map<Long, Way> ways = new Hashtable<>(); |
||||||
|
private Map<Long, Node> nodes = new Hashtable<>(); |
||||||
|
private Set<Integer> strings = new HashSet<>(); |
||||||
|
|
||||||
|
|
||||||
|
private CliOpt cliOpt = new CliOpt(); |
||||||
|
|
||||||
|
public static void main(String [] args){ |
||||||
|
new ExtractElement().run(args); |
||||||
|
} |
||||||
|
|
||||||
|
private void run(String[] args) { |
||||||
|
CommandLineParser parser = new DefaultParser(); |
||||||
|
String dbFilePath; |
||||||
|
String outputFilePath = null; |
||||||
|
String actionFilePath; |
||||||
|
String format; |
||||||
|
try { |
||||||
|
CommandLine cmd = parser.parse(getOptions(), args); |
||||||
|
if(args.length == 0 || cmd.hasOption(cliOpt.help)){ |
||||||
|
printHelp(0); |
||||||
|
} |
||||||
|
dbFilePath = cmd.getOptionValue(cliOpt.dbFile); |
||||||
|
actionFilePath = cmd.getOptionValue(cliOpt.actionFile); |
||||||
|
format = cmd.getOptionValue(cliOpt.outputFormat); |
||||||
|
if(cmd.hasOption(cliOpt.outputFile)){ |
||||||
|
outputFilePath = cmd.getOptionValue(cliOpt.outputFile); |
||||||
|
} |
||||||
|
log.always().log("Database file : {}", dbFilePath); |
||||||
|
log.always().log("Action file : {}", actionFilePath); |
||||||
|
log.always().log("Output : {}", outputFilePath==null?"STDOUT":outputFilePath); |
||||||
|
log.always().log("Format : {}", format); |
||||||
|
log.atInfo().log("{} formatter found, with {} format names", FormatterManager.getInstance().getOutputFormatterCount(), FormatterManager.getInstance().size()); |
||||||
|
if(!FormatterManager.getInstance().containsKey(format)){ |
||||||
|
log.atError().log("Unknown output format {}", format); |
||||||
|
StringBuilder sb = new StringBuilder(); |
||||||
|
Iterator<String> iFormat = FormatterManager.getInstance().keySet().iterator(); |
||||||
|
while(iFormat.hasNext()){ |
||||||
|
sb.append(iFormat.next()); |
||||||
|
if(iFormat.hasNext()){ |
||||||
|
sb.append(" ,"); |
||||||
|
} |
||||||
|
} |
||||||
|
log.atError().log("Valid format names: {}", sb); |
||||||
|
System.exit(2); |
||||||
|
} |
||||||
|
PrintStream outputStream = outputFilePath==null?System.out:new PrintStream(new File(outputFilePath)); |
||||||
|
File dbFile = new File(dbFilePath); |
||||||
|
if(!dbFile.exists() || !dbFile.canRead()){ |
||||||
|
log.atError().log("Unable to read db file {}", dbFilePath); |
||||||
|
System.exit(2); |
||||||
|
} |
||||||
|
File actionFile = new File(actionFilePath); |
||||||
|
if(!actionFile.exists() || !actionFile.canRead()){ |
||||||
|
log.atError().log("Unable to read action file {}", actionFilePath); |
||||||
|
System.exit(2); |
||||||
|
} |
||||||
|
log.atInfo().log("Database file size {}MB", dbFile.length()/1_000_000); |
||||||
|
log.atInfo().log("Action file size {}kB", actionFile.length()/1_000); |
||||||
|
doExtract(dbFile, actionFile, outputStream); |
||||||
|
|
||||||
|
} catch(MissingOptionException|MissingArgumentException moe) { |
||||||
|
System.out.println("FATAL ERROR : "+moe.getMessage()); |
||||||
|
printHelp(1); |
||||||
|
}catch (ParseException e) { |
||||||
|
System.err.println("Fatal error - unable to parse command line input!"); |
||||||
|
e.printStackTrace(); |
||||||
|
System.exit(1); |
||||||
|
} catch (FileNotFoundException e) { |
||||||
|
log.atError().withThrowable(e).log("Unable to locate the specified file"); |
||||||
|
System.exit(1); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
private void doExtract(File dbFile, File actionFile, PrintStream outputStream) { |
||||||
|
//Step 1: parse the actionFile
|
||||||
|
ActionFile af; |
||||||
|
try { |
||||||
|
af = new ActionFile(actionFile); |
||||||
|
} catch (IOException|SAXException|ParserConfigurationException e) { |
||||||
|
log.atError().withThrowable(e).log("Unable to parse the action file"); |
||||||
|
System.exit(3); |
||||||
|
return; |
||||||
|
} |
||||||
|
expandRelations(dbFile, af, af.getRelation()); |
||||||
|
processWay(dbFile, af); |
||||||
|
processNode(dbFile, af); |
||||||
|
} |
||||||
|
|
||||||
|
private void processNode(File dbFile, ActionFile af) { |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
private void processWay(File dbFile, ActionFile af) { |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
private void expandRelations(File dbFile, ActionFile af, Collection<ExtractItem> relations) { |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
private void printHelp(int returnValue){ |
||||||
|
HelpFormatter formatter = new HelpFormatter(); |
||||||
|
formatter.printHelp("java "+ExtractElement.class.getName(), "", options, "", true); |
||||||
|
if(returnValue!=Integer.MIN_VALUE) { |
||||||
|
System.exit(returnValue); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
private synchronized Options getOptions(){ |
||||||
|
if(options==null) { |
||||||
|
options = new Options(); |
||||||
|
options.addOption(cliOpt.dbFile); |
||||||
|
options.addOption(cliOpt.outputFile); |
||||||
|
options.addOption(cliOpt.actionFile); |
||||||
|
options.addOption(cliOpt.help); |
||||||
|
options.addOption(cliOpt.outputFormat); |
||||||
|
} |
||||||
|
return options; |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,106 @@ |
|||||||
|
package org.leolo.map.osm.extract; |
||||||
|
|
||||||
|
import eu.infomas.annotation.AnnotationDetector; |
||||||
|
import org.apache.logging.log4j.LogManager; |
||||||
|
import org.apache.logging.log4j.Logger; |
||||||
|
|
||||||
|
import java.io.IOException; |
||||||
|
import java.lang.annotation.Annotation; |
||||||
|
import java.util.*; |
||||||
|
import java.util.function.BiConsumer; |
||||||
|
|
||||||
|
public class FormatterManager { |
||||||
|
|
||||||
|
private static FormatterManager instance; |
||||||
|
private Logger log = LogManager.getLogger(); |
||||||
|
private Hashtable<String, Class> outformats; |
||||||
|
|
||||||
|
public static synchronized FormatterManager getInstance(){ |
||||||
|
if(instance==null){ |
||||||
|
instance = new FormatterManager(); |
||||||
|
} |
||||||
|
return instance; |
||||||
|
} |
||||||
|
|
||||||
|
private FormatterManager(){ |
||||||
|
log.atDebug().log("Looking for output formatter"); |
||||||
|
final AnnotationDetector.TypeReporter reporter = new AnnotationDetector.TypeReporter() { |
||||||
|
@Override |
||||||
|
public void reportTypeAnnotation(Class<? extends Annotation> annoClass, String clazz) { |
||||||
|
log.atDebug().log("Class {} has annotation {}", clazz, annoClass.getName()); |
||||||
|
try { |
||||||
|
Class typeClass = Class.forName(clazz); |
||||||
|
if(OutputFormat.class.isAssignableFrom(typeClass)){ |
||||||
|
log.atDebug().log("Class {} is an output formatter", clazz); |
||||||
|
OutputFormatter of = (OutputFormatter) typeClass.getAnnotation(OutputFormatter.class); |
||||||
|
for(String format: of.formatName()){ |
||||||
|
if(outformats.containsKey(format)){ |
||||||
|
log.atWarn().log("Duplicated format {}. Shared by (at least) {} and {}", |
||||||
|
format, |
||||||
|
typeClass.getName(), |
||||||
|
outformats.get(format).getName() |
||||||
|
); |
||||||
|
}else{ |
||||||
|
outformats.put(format, typeClass); |
||||||
|
log.atInfo().log("Registering class {} for output format {}", typeClass, format); |
||||||
|
} |
||||||
|
} |
||||||
|
}else{ |
||||||
|
log.atError().log("Class {} does not implements OutputFormat but have annotation @OutputFormatter", clazz); |
||||||
|
} |
||||||
|
} catch (ClassNotFoundException e) { |
||||||
|
log.atError().withThrowable(e).log(e.getMessage()); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public Class<? extends Annotation>[] annotations() { |
||||||
|
return new Class[]{OutputFormatter.class}; |
||||||
|
} |
||||||
|
}; |
||||||
|
final AnnotationDetector cf = new AnnotationDetector(reporter); |
||||||
|
outformats = new Hashtable<>(); |
||||||
|
try { |
||||||
|
cf.detect(); |
||||||
|
} catch (IOException e) { |
||||||
|
log.atError().withThrowable(e).log(e.getMessage()); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public int size() { |
||||||
|
return outformats.size(); |
||||||
|
} |
||||||
|
|
||||||
|
public boolean isEmpty() { |
||||||
|
return outformats.isEmpty(); |
||||||
|
} |
||||||
|
|
||||||
|
public Enumeration<String> keys() { |
||||||
|
return outformats.keys(); |
||||||
|
} |
||||||
|
|
||||||
|
public boolean containsKey(Object key) { |
||||||
|
return outformats.containsKey(key); |
||||||
|
} |
||||||
|
|
||||||
|
public Class get(Object key) { |
||||||
|
return outformats.get(key); |
||||||
|
} |
||||||
|
|
||||||
|
public Set<String> keySet() { |
||||||
|
return outformats.keySet(); |
||||||
|
} |
||||||
|
|
||||||
|
public void forEach(BiConsumer<? super String, ? super Class> action) { |
||||||
|
outformats.forEach(action); |
||||||
|
} |
||||||
|
|
||||||
|
public int getOutputFormatterCount(){ |
||||||
|
HashSet<Class> set = new HashSet<>(); |
||||||
|
for(Class clazz:outformats.values()){ |
||||||
|
set.add(clazz); |
||||||
|
} |
||||||
|
return set.size(); |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,4 @@ |
|||||||
|
package org.leolo.map.osm.extract; |
||||||
|
|
||||||
|
public interface OutputFormat { |
||||||
|
} |
||||||
@ -0,0 +1,12 @@ |
|||||||
|
package org.leolo.map.osm.extract; |
||||||
|
|
||||||
|
import java.lang.annotation.ElementType; |
||||||
|
import java.lang.annotation.Retention; |
||||||
|
import java.lang.annotation.RetentionPolicy; |
||||||
|
import java.lang.annotation.Target; |
||||||
|
|
||||||
|
@Target(ElementType.TYPE) |
||||||
|
@Retention(RetentionPolicy.RUNTIME) |
||||||
|
public @interface OutputFormatter { |
||||||
|
String[] formatName(); |
||||||
|
} |
||||||
@ -0,0 +1,8 @@ |
|||||||
|
package org.leolo.map.osm.extract.format; |
||||||
|
|
||||||
|
import org.leolo.map.osm.extract.OutputFormat; |
||||||
|
import org.leolo.map.osm.extract.OutputFormatter; |
||||||
|
|
||||||
|
@OutputFormatter(formatName = {"kml","application/vnd.google-earth.kml+xml"}) |
||||||
|
public class KMLFormatter implements OutputFormat { |
||||||
|
} |
||||||
@ -0,0 +1,8 @@ |
|||||||
|
package org.leolo.map.osm.extract.format; |
||||||
|
|
||||||
|
import org.leolo.map.osm.extract.OutputFormat; |
||||||
|
import org.leolo.map.osm.extract.OutputFormatter; |
||||||
|
|
||||||
|
@OutputFormatter(formatName = "plain") |
||||||
|
public class PlainFormatter implements OutputFormat { |
||||||
|
} |
||||||
@ -0,0 +1,121 @@ |
|||||||
|
package org.leolo.map.osm.extract.model; |
||||||
|
|
||||||
|
import org.apache.logging.log4j.LogManager; |
||||||
|
import org.apache.logging.log4j.Logger; |
||||||
|
import org.w3c.dom.Document; |
||||||
|
import org.w3c.dom.Element; |
||||||
|
import org.w3c.dom.Node; |
||||||
|
import org.w3c.dom.NodeList; |
||||||
|
import org.xml.sax.SAXException; |
||||||
|
|
||||||
|
import javax.xml.parsers.DocumentBuilder; |
||||||
|
import javax.xml.parsers.DocumentBuilderFactory; |
||||||
|
import javax.xml.parsers.ParserConfigurationException; |
||||||
|
import java.io.File; |
||||||
|
import java.io.IOException; |
||||||
|
import java.util.*; |
||||||
|
|
||||||
|
public class ActionFile { |
||||||
|
|
||||||
|
Logger log = LogManager.getLogger(); |
||||||
|
|
||||||
|
private Map<Long,ExtractItem> relation = new Hashtable<>(); |
||||||
|
private Map<Long,ExtractItem> way = new Hashtable<>(); |
||||||
|
private Map<Long,ExtractItem> node = new Hashtable<>(); |
||||||
|
|
||||||
|
public ActionFile(File path) throws IOException, SAXException, ParserConfigurationException { |
||||||
|
log.atInfo().log("Parsing action file {}", path.getAbsolutePath()); |
||||||
|
DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); |
||||||
|
Document doc = builder.parse(path); |
||||||
|
doc.getDocumentElement().normalize(); |
||||||
|
Element rootElement = doc.getDocumentElement(); |
||||||
|
log.atDebug().log("Root element : {}", rootElement.getTagName()); |
||||||
|
Node extract = rootElement.getElementsByTagName("extracts").item(0); |
||||||
|
NodeList extractItems = extract.getChildNodes(); |
||||||
|
for(int i=0;i<extractItems.getLength();i++){ |
||||||
|
Node child = extractItems.item(i); |
||||||
|
if("#text".equals(child.getNodeName()) || "#comment".equals(child.getNodeName())){ |
||||||
|
continue; |
||||||
|
} |
||||||
|
String id = child.getAttributes().getNamedItem("id").getNodeValue(); |
||||||
|
log.atDebug().log("Extracts {} #{}", child.getNodeName(), id); |
||||||
|
ExtractItem ei = new ExtractItem(); |
||||||
|
ei.setId(Long.parseLong(id)); |
||||||
|
NodeList childList = child.getChildNodes(); |
||||||
|
for(int j=0;j<childList.getLength();j++){ |
||||||
|
Node param = childList.item(j); |
||||||
|
if("#text".equals(param.getNodeName()) || "#comment".equals(param.getNodeName())){ |
||||||
|
continue; |
||||||
|
} |
||||||
|
log.atDebug().log("param : {}", param.getNodeName()); |
||||||
|
if("label".equals(param.getNodeName())){ |
||||||
|
ei.setLabel(param.getTextContent()); |
||||||
|
log.atDebug().log("Label : {}", param.getTextContent()); |
||||||
|
}else{ |
||||||
|
if(ei.getParameter().containsKey(param.getNodeName())){ |
||||||
|
if(ei.getParameter().get(param.getNodeName()) instanceof List){ |
||||||
|
((List)ei.getParameter().get(param.getNodeName())).add(param.getTextContent()); |
||||||
|
}else{ |
||||||
|
Vector<Object> v = new Vector<>(); |
||||||
|
v.add(ei.getParameter().get(param.getNodeName())); |
||||||
|
v.add(param.getTextContent()); |
||||||
|
ei.getParameter().put(param.getNodeName(), v); |
||||||
|
} |
||||||
|
}else{ |
||||||
|
ei.getParameter().put(param.getNodeName(), param.getTextContent()); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
ei.setFromFile(true); |
||||||
|
if("relation".equals(child.getNodeName())){ |
||||||
|
addRelation(ei); |
||||||
|
}else if("way".equals(child.getNodeName())){ |
||||||
|
addWay(ei); |
||||||
|
}else if("node".equals(child.getNodeName())){ |
||||||
|
addNode(ei); |
||||||
|
}else{ |
||||||
|
log.atWarn().log("Unknown node name {}", child.getNodeName()); |
||||||
|
} |
||||||
|
} |
||||||
|
Node properties = rootElement.getElementsByTagName("properties").item(0); |
||||||
|
NodeList props = properties.getChildNodes(); |
||||||
|
for(int i=0;i<props.getLength();i++){ |
||||||
|
Node child = extractItems.item(i); |
||||||
|
if(child==null||"#text".equals(child.getNodeName()) || "#comment".equals(child.getNodeName())){ |
||||||
|
continue; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public Collection<ExtractItem> getRelation() { |
||||||
|
return relation.values(); |
||||||
|
} |
||||||
|
|
||||||
|
public Collection<ExtractItem> getWay() { |
||||||
|
return way.values(); |
||||||
|
} |
||||||
|
|
||||||
|
public Collection<ExtractItem> getNode() { |
||||||
|
return node.values(); |
||||||
|
} |
||||||
|
|
||||||
|
@Deprecated |
||||||
|
public void sortList(){ |
||||||
|
|
||||||
|
} |
||||||
|
public void addRelation(ExtractItem ei) { |
||||||
|
if(!relation.containsKey(ei.getId())) |
||||||
|
relation.put(ei.getId(), ei); |
||||||
|
} |
||||||
|
public void addNode(ExtractItem ei) { |
||||||
|
if(!node.containsKey(ei.getId())) |
||||||
|
node.put(ei.getId(), ei); |
||||||
|
} |
||||||
|
|
||||||
|
public void addWay(ExtractItem ei) { |
||||||
|
if(!way.containsKey(ei.getId())) |
||||||
|
way.put(ei.getId(), ei); |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,44 @@ |
|||||||
|
package org.leolo.map.osm.extract.model; |
||||||
|
|
||||||
|
import java.util.Hashtable; |
||||||
|
import java.util.Map; |
||||||
|
|
||||||
|
public class ExtractItem implements Comparable<ExtractItem>{ |
||||||
|
private long id; |
||||||
|
private String label; |
||||||
|
private Map<String, Object> parameter = new Hashtable<>(); |
||||||
|
private boolean fromFile = false; |
||||||
|
|
||||||
|
public boolean isFromFile() { |
||||||
|
return fromFile; |
||||||
|
} |
||||||
|
|
||||||
|
public void setFromFile(boolean fromFile) { |
||||||
|
this.fromFile = fromFile; |
||||||
|
} |
||||||
|
|
||||||
|
public long getId() { |
||||||
|
return id; |
||||||
|
} |
||||||
|
|
||||||
|
public void setId(long id) { |
||||||
|
this.id = id; |
||||||
|
} |
||||||
|
|
||||||
|
public String getLabel() { |
||||||
|
return label; |
||||||
|
} |
||||||
|
|
||||||
|
public void setLabel(String label) { |
||||||
|
this.label = label; |
||||||
|
} |
||||||
|
|
||||||
|
public Map<String, Object> getParameter() { |
||||||
|
return parameter; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public int compareTo(ExtractItem o) { |
||||||
|
return Long.compare(id, o.id); |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,33 @@ |
|||||||
|
package org.leolo.map.osm.extract.model; |
||||||
|
|
||||||
|
import java.util.Hashtable; |
||||||
|
import java.util.Map; |
||||||
|
import java.util.Set; |
||||||
|
|
||||||
|
public class MapEntry { |
||||||
|
private Map<String, String> tags = new Hashtable<>(); |
||||||
|
|
||||||
|
public int tagCount() { |
||||||
|
return tags.size(); |
||||||
|
} |
||||||
|
|
||||||
|
public boolean hasNoTags() { |
||||||
|
return tags.isEmpty(); |
||||||
|
} |
||||||
|
|
||||||
|
public boolean containsTag(Object key) { |
||||||
|
return tags.containsKey(key); |
||||||
|
} |
||||||
|
|
||||||
|
public String getTag(Object key) { |
||||||
|
return tags.get(key); |
||||||
|
} |
||||||
|
|
||||||
|
public void putTag(String key, String value) { |
||||||
|
tags.put(key, value); |
||||||
|
} |
||||||
|
|
||||||
|
public Set<String> tagSet() { |
||||||
|
return tags.keySet(); |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,12 @@ |
|||||||
|
package org.leolo.map.osm.extract.model; |
||||||
|
|
||||||
|
|
||||||
|
public class Node extends MapEntry{ |
||||||
|
private double lat; |
||||||
|
private double lon; |
||||||
|
|
||||||
|
public Node(double lat, double lon) { |
||||||
|
this.lat = lat; |
||||||
|
this.lon = lon; |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,28 @@ |
|||||||
|
package org.leolo.map.osm.extract.model; |
||||||
|
|
||||||
|
import java.util.*; |
||||||
|
|
||||||
|
public class Relation extends MapEntry{ |
||||||
|
private List<Long> members = new Vector<>(); |
||||||
|
|
||||||
|
|
||||||
|
public int memberCount() { |
||||||
|
return members.size(); |
||||||
|
} |
||||||
|
|
||||||
|
public boolean addMember(Long aLong) { |
||||||
|
return members.add(aLong); |
||||||
|
} |
||||||
|
|
||||||
|
public boolean removeMember(Object o) { |
||||||
|
return members.remove(o); |
||||||
|
} |
||||||
|
|
||||||
|
public boolean containsAllMembers(Collection<?> c) { |
||||||
|
return members.containsAll(c); |
||||||
|
} |
||||||
|
|
||||||
|
public Long getMember(int index) { |
||||||
|
return members.get(index); |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,30 @@ |
|||||||
|
package org.leolo.map.osm.extract.model; |
||||||
|
|
||||||
|
import java.util.Collection; |
||||||
|
import java.util.List; |
||||||
|
import java.util.Vector; |
||||||
|
|
||||||
|
public class Way extends MapEntry{ |
||||||
|
|
||||||
|
private List<Long> members = new Vector<>(); |
||||||
|
public int memberCount() { |
||||||
|
return members.size(); |
||||||
|
} |
||||||
|
|
||||||
|
public boolean addMember(Long aLong) { |
||||||
|
return members.add(aLong); |
||||||
|
} |
||||||
|
|
||||||
|
public boolean removeMember(Object o) { |
||||||
|
return members.remove(o); |
||||||
|
} |
||||||
|
|
||||||
|
public boolean containsAllMembers(Collection<?> c) { |
||||||
|
return members.containsAll(c); |
||||||
|
} |
||||||
|
|
||||||
|
public Long getMember(int index) { |
||||||
|
return members.get(index); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,22 @@ |
|||||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||||
|
<Configuration status="warn"> |
||||||
|
<Appenders> |
||||||
|
<Console name="Console" target="SYSTEM_OUT"> |
||||||
|
<PatternLayout |
||||||
|
pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n" /> |
||||||
|
</Console> |
||||||
|
<File name="RIlog" fileName="ri_log"> |
||||||
|
<PatternLayout |
||||||
|
pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n" /> |
||||||
|
</File> |
||||||
|
</Appenders> |
||||||
|
<Loggers> |
||||||
|
<Root level="debug"> |
||||||
|
<AppenderRef ref="Console" /> |
||||||
|
</Root> |
||||||
|
<Logger name="org.leolo.RI"> |
||||||
|
<AppenderRef ref="Console" /> |
||||||
|
<AppenderRef ref="RIlog" /> |
||||||
|
</Logger> |
||||||
|
</Loggers> |
||||||
|
</Configuration> |
||||||
Loading…
Reference in new issue