e47db889 by chiangbt

update3

1 parent c102032f
......@@ -3,13 +3,15 @@
<component name="ChangeListManager">
<list default="true" id="5b5a29d8-78e9-4a9f-a415-1e11442b5ca7" name="Default" comment="">
<change type="DELETED" beforePath="$PROJECT_DIR$/my.db" afterPath="" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/out/production/TiandituDownloader/Main.class" afterPath="$PROJECT_DIR$/out/production/TiandituDownloader/Main.class" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/out/production/TiandituDownloader/TiandituDownload.class" afterPath="$PROJECT_DIR$/out/production/TiandituDownloader/TiandituDownload.class" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/uiDesigner.xml" afterPath="$PROJECT_DIR$/.idea/uiDesigner.xml" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/out/production/TiandituDownloader/utils/CalEnv.class" afterPath="$PROJECT_DIR$/out/production/TiandituDownloader/utils/CalEnv.class" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/out/production/TiandituDownloader/utils/Point.class" afterPath="$PROJECT_DIR$/out/production/TiandituDownloader/utils/Point.class" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/readme.md" afterPath="$PROJECT_DIR$/readme.md" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/Main.java" afterPath="$PROJECT_DIR$/src/Main.java" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/TiandituDownload.java" afterPath="$PROJECT_DIR$/src/TiandituDownload.java" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/utils/CalEnv.java" afterPath="$PROJECT_DIR$/src/utils/CalEnv.java" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/utils/Point.java" afterPath="$PROJECT_DIR$/src/utils/Point.java" />
</list>
<ignored path="$PROJECT_DIR$/out/" />
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
......@@ -21,11 +23,11 @@
</component>
<component name="FileEditorManager">
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
<file leaf-file-name="Main.java" pinned="false" current-in-tab="false">
<file leaf-file-name="Main.java" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/src/Main.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="210">
<caret line="14" column="87" lean-forward="false" selection-start-line="14" selection-start-column="87" selection-end-line="14" selection-end-column="87" />
<caret line="14" column="79" lean-forward="false" selection-start-line="14" selection-start-column="79" selection-end-line="14" selection-end-column="79" />
<folding>
<element signature="imports" expanded="true" />
</folding>
......@@ -33,68 +35,23 @@
</provider>
</entry>
</file>
<file leaf-file-name="readme.md" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/readme.md">
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
<state split_layout="SPLIT">
<first_editor relative-caret-position="210">
<caret line="14" column="44" lean-forward="false" selection-start-line="14" selection-start-column="44" selection-end-line="14" selection-end-column="44" />
<folding />
</first_editor>
<second_editor />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="TiandituDownload.java" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/TiandituDownload.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="190">
<caret line="114" column="60" lean-forward="true" selection-start-line="114" selection-start-column="60" selection-end-line="114" selection-end-column="60" />
<state relative-caret-position="295">
<caret line="45" column="10" lean-forward="false" selection-start-line="45" selection-start-column="10" selection-end-line="45" selection-end-column="10" />
<folding>
<element signature="imports" expanded="true" />
<element signature="method#calculateEnv#0;class#TiandituDownload#0" expanded="false" />
<element signature="e#2063#2064#0" expanded="true" />
<element signature="method#getTile#0;class#TiandituDownload#0" expanded="false" />
<marker date="1522048729940" expanded="true" signature="3123:3220" ph="select * fro... missingValue" />
<marker date="1522048729940" expanded="true" signature="5353:5429" ph="INSERT INTO missingValue... " />
<marker date="1522048729940" expanded="true" signature="6550:6737" ph="CREATE TABLE... IF" />
<marker date="1522070065953" expanded="true" signature="3289:3386" ph="select * fro... missingValue" />
<marker date="1522070065953" expanded="true" signature="5529:5606" ph="INSERT INTO missingValue... " />
<marker date="1522070065953" expanded="true" signature="6731:6918" ph="CREATE TABLE... IF" />
</folding>
</state>
</provider>
</entry>
</file>
<file leaf-file-name="TDTUrl.java" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/utils/TDTUrl.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="15">
<caret line="1" column="0" lean-forward="false" selection-start-line="1" selection-start-column="0" selection-end-line="1" selection-end-column="0" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file leaf-file-name="TianDiTuTiledMapServiceType.java" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/utils/TianDiTuTiledMapServiceType.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="30">
<caret line="2" column="3" lean-forward="false" selection-start-line="2" selection-start-column="3" selection-end-line="2" selection-end-column="3" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="Point.java" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/utils/Point.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="10" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="1" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
</file>
</leaf>
</component>
<component name="FileTemplateManagerImpl">
......@@ -117,17 +74,17 @@
<list>
<option value="$PROJECT_DIR$/src/Point.java" />
<option value="$PROJECT_DIR$/src/CalEnv.java" />
<option value="$PROJECT_DIR$/src/utils/CalEnv.java" />
<option value="$PROJECT_DIR$/src/utils/Point.java" />
<option value="$PROJECT_DIR$/src/TianDiTuTiledMapServiceType.java" />
<option value="$PROJECT_DIR$/src/TDTUrl.java" />
<option value="$PROJECT_DIR$/src/utils/TianDiTuTiledMapServiceType.java" />
<option value="$PROJECT_DIR$/src/utils/TDTUrl.java" />
<option value="$PROJECT_DIR$/src/MainForm.java" />
<option value="$PROJECT_DIR$/src/MainForm.form" />
<option value="$PROJECT_DIR$/readme.md" />
<option value="$PROJECT_DIR$/src/utils/Point.java" />
<option value="$PROJECT_DIR$/src/utils/CalEnv.java" />
<option value="$PROJECT_DIR$/src/Main.java" />
<option value="$PROJECT_DIR$/src/TiandituDownload.java" />
<option value="$PROJECT_DIR$/readme.md" />
</list>
</option>
</component>
......@@ -138,8 +95,8 @@
<sorting>DEFINITION_ORDER</sorting>
</component>
<component name="ProjectFrameBounds">
<option name="x" value="40" />
<option name="y" value="23" />
<option name="x" value="171" />
<option name="y" value="29" />
<option name="width" value="1400" />
<option name="height" value="771" />
</component>
......@@ -159,10 +116,9 @@
<foldersAlwaysOnTop value="true" />
</navigator>
<panes>
<pane id="Scope" />
<pane id="Scratches" />
<pane id="PackagesPane" />
<pane id="AndroidView" />
<pane id="Scope" />
<pane id="ProjectPane">
<subPane>
<expand>
......@@ -177,12 +133,19 @@
</path>
<path>
<item name="TiandituDownloader" type="b2602c69:ProjectViewProjectNode" />
<item name="TiandituDownloader" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
<item name="utils" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="TiandituDownloader" type="b2602c69:ProjectViewProjectNode" />
<item name="External Libraries" type="cb654da1:ExternalLibrariesNode" />
</path>
</expand>
<select />
</subPane>
</pane>
<pane id="AndroidView" />
</panes>
</component>
<component name="PropertiesComponent">
......@@ -266,15 +229,16 @@
<option name="presentableId" value="Default" />
<updated>1522029080525</updated>
<workItem from="1522029083503" duration="8800000" />
<workItem from="1522044614927" duration="3890000" />
<workItem from="1522044614927" duration="4004000" />
<workItem from="1522068118889" duration="1963000" />
</task>
<servers />
</component>
<component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="12690000" />
<option name="totallyTimeSpent" value="14767000" />
</component>
<component name="ToolWindowManager">
<frame x="40" y="23" width="1400" height="771" extended-state="0" />
<frame x="171" y="29" width="1400" height="771" extended-state="0" />
<editor active="true" />
<layout>
<window_info id="Palette" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
......@@ -287,10 +251,10 @@
<window_info id="Maven Projects" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.32988167" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32988167" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.14201184" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Capture Tool" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Designer" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.17157584" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.100883655" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
<window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32988167" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
......@@ -348,6 +312,68 @@
<component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/src/Main.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="165">
<caret line="14" column="87" lean-forward="false" selection-start-line="14" selection-start-column="87" selection-end-line="14" selection-end-column="87" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/TiandituDownload.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1710">
<caret line="114" column="60" lean-forward="true" selection-start-line="114" selection-start-column="60" selection-end-line="114" selection-end-column="60" />
<folding>
<element signature="imports" expanded="true" />
<element signature="e#2063#2064#0" expanded="true" />
<element signature="method#getTile#0;class#TiandituDownload#0" expanded="false" />
<marker date="1522070065953" expanded="true" signature="3289:3386" ph="select * fro... missingValue" />
<marker date="1522070065953" expanded="true" signature="5529:5606" ph="INSERT INTO missingValue... " />
<marker date="1522070065953" expanded="true" signature="6731:6918" ph="CREATE TABLE... IF" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/utils/TDTUrl.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="15">
<caret line="1" column="0" lean-forward="false" selection-start-line="1" selection-start-column="0" selection-end-line="1" selection-end-column="0" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/utils/TianDiTuTiledMapServiceType.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="30">
<caret line="2" column="3" lean-forward="false" selection-start-line="2" selection-start-column="3" selection-end-line="2" selection-end-column="3" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/utils/Point.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="10" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="1" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/readme.md">
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
<state split_layout="SPLIT">
<first_editor relative-caret-position="255">
<caret line="17" column="3" lean-forward="true" selection-start-line="17" selection-start-column="3" selection-end-line="17" selection-end-column="3" />
<folding />
</first_editor>
<second_editor />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/Main.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="180">
<caret line="15" column="83" lean-forward="false" selection-start-line="11" selection-start-column="8" selection-end-line="15" selection-end-column="83" />
<folding>
......@@ -362,11 +388,11 @@
<caret line="11" column="29" lean-forward="false" selection-start-line="11" selection-start-column="13" selection-end-line="11" selection-end-column="29" />
<folding>
<element signature="imports" expanded="true" />
<element signature="method#calculateEnv#0;class#TiandituDownload#0" expanded="false" />
<element signature="e#2063#2064#0" expanded="true" />
<element signature="method#getTile#0;class#TiandituDownload#0" expanded="false" />
<marker date="1522048729940" expanded="true" signature="3123:3220" ph="select * fro... missingValue" />
<marker date="1522048729940" expanded="true" signature="5353:5429" ph="INSERT INTO missingValue... " />
<marker date="1522048729940" expanded="true" signature="6550:6737" ph="CREATE TABLE... IF" />
<marker date="1522070065953" expanded="true" signature="3289:3386" ph="select * fro... missingValue" />
<marker date="1522070065953" expanded="true" signature="5529:5606" ph="INSERT INTO missingValue... " />
<marker date="1522070065953" expanded="true" signature="6731:6918" ph="CREATE TABLE... IF" />
</folding>
</state>
</provider>
......@@ -415,17 +441,23 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/utils/CalEnv.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="30">
<caret line="2" column="13" lean-forward="false" selection-start-line="2" selection-start-column="13" selection-end-line="2" selection-end-column="13" />
<entry file="file://$PROJECT_DIR$/src/MainForm.form" />
<entry file="file://$PROJECT_DIR$/src/MainForm.java" />
<entry file="file://$PROJECT_DIR$/readme.md">
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
<state split_layout="SPLIT">
<first_editor relative-caret-position="255">
<caret line="17" column="3" lean-forward="false" selection-start-line="17" selection-start-column="3" selection-end-line="17" selection-end-column="3" />
<folding />
</first_editor>
<second_editor />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/utils/Point.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="10" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="1" selection-end-column="0" />
<state relative-caret-position="45">
<caret line="3" column="7" lean-forward="false" selection-start-line="3" selection-start-column="7" selection-end-line="3" selection-end-column="7" />
<folding />
</state>
</provider>
......@@ -440,60 +472,47 @@
</entry>
<entry file="file://$PROJECT_DIR$/src/utils/TDTUrl.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="15">
<caret line="1" column="0" lean-forward="false" selection-start-line="1" selection-start-column="0" selection-end-line="1" selection-end-column="0" />
<state relative-caret-position="-467">
<caret line="9" column="0" lean-forward="true" selection-start-line="9" selection-start-column="0" selection-end-line="9" selection-end-column="0" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/MainForm.form">
<provider selected="true" editor-type-id="ui-designer">
<state />
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/MainForm.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="75">
<caret line="5" column="0" lean-forward="true" selection-start-line="5" selection-start-column="0" selection-end-line="5" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/Main.java">
<entry file="file://$PROJECT_DIR$/src/utils/CalEnv.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="210">
<caret line="14" column="87" lean-forward="false" selection-start-line="14" selection-start-column="87" selection-end-line="14" selection-end-column="87" />
<state relative-caret-position="253">
<caret line="28" column="27" lean-forward="false" selection-start-line="28" selection-start-column="27" selection-end-line="28" selection-end-column="27" />
<folding>
<element signature="imports" expanded="true" />
<element signature="e#487#488#0" expanded="true" />
<element signature="e#527#528#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/TiandituDownload.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="190">
<caret line="114" column="60" lean-forward="true" selection-start-line="114" selection-start-column="60" selection-end-line="114" selection-end-column="60" />
<state relative-caret-position="295">
<caret line="45" column="10" lean-forward="false" selection-start-line="45" selection-start-column="10" selection-end-line="45" selection-end-column="10" />
<folding>
<element signature="imports" expanded="true" />
<element signature="method#calculateEnv#0;class#TiandituDownload#0" expanded="false" />
<element signature="e#2063#2064#0" expanded="true" />
<element signature="method#getTile#0;class#TiandituDownload#0" expanded="false" />
<marker date="1522048729940" expanded="true" signature="3123:3220" ph="select * fro... missingValue" />
<marker date="1522048729940" expanded="true" signature="5353:5429" ph="INSERT INTO missingValue... " />
<marker date="1522048729940" expanded="true" signature="6550:6737" ph="CREATE TABLE... IF" />
<marker date="1522070065953" expanded="true" signature="3289:3386" ph="select * fro... missingValue" />
<marker date="1522070065953" expanded="true" signature="5529:5606" ph="INSERT INTO missingValue... " />
<marker date="1522070065953" expanded="true" signature="6731:6918" ph="CREATE TABLE... IF" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/readme.md">
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
<state split_layout="SPLIT">
<first_editor relative-caret-position="210">
<caret line="14" column="44" lean-forward="false" selection-start-line="14" selection-start-column="44" selection-end-line="14" selection-end-column="44" />
<folding />
</first_editor>
<second_editor />
<entry file="file://$PROJECT_DIR$/src/Main.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="210">
<caret line="14" column="79" lean-forward="false" selection-start-line="14" selection-start-column="79" selection-end-line="14" selection-end-column="79" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
......
No preview for this file type
......@@ -4,15 +4,15 @@ TiandituDownload主要用于下载天地图数据,其坐标系为CGCS2000.
```java
// 设置要下载的图片存储sqlite路径
TiandituDownload tiandituDownload = new TiandituDownload("my.db");
// 范围起始点(左下角、右上角)
Point pt = new Point(29.76,106.64);
Point pt2 = new Point(35.33, 108.12);
// 下载器
// 2 为最小level,9为最大level
// TianDiTuTiledMapServiceType.IMG_C 为下载数据类型
// 最后一个参数为merge,为true时,会将地图及其注记一并下载融合到一张图片中去
tiandituDownload.Download(pt, pt2, 2,9, TianDiTuTiledMapServiceType.IMG_C, true);
// 设置要下载的图片存储sqlite路径
TiandituDownload tiandituDownload = new TiandituDownload("my.db");
// 范围起始点(左下角、右上角)
Point pt = new Point(29.76,106.64);
Point pt2 = new Point(35.33, 108.12);
// 下载器
// 2 为最小level,9为最大level
// TianDiTuTiledMapServiceType.IMG_C 为下载数据类型
// 最后一个参数为merge,为true时,会将地图及其注记一并下载融合到一张图片中去
tiandituDownload.Download(pt, pt2, 2,9, TianDiTuTiledMapServiceType.IMG_C, true);
```
\ No newline at end of file
......
......@@ -12,6 +12,7 @@ public class Main{
TiandituDownload tiandituDownload = new TiandituDownload("my.db");
Point pt = new Point(29.76,106.64);
Point pt2 = new Point(35.33, 108.12);
tiandituDownload.Download(pt, pt2, 2,9, TianDiTuTiledMapServiceType.VEC_C, true);
tiandituDownload.Download(pt, pt2, 7,9, TianDiTuTiledMapServiceType.VEC_C, true);
}
}
......
......@@ -16,6 +16,10 @@ import java.sql.*;
public class TiandituDownload {
// 级别
int[] level = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20};
// 分辨率
double[] res = {
1.40625,
0.703125,
......@@ -39,6 +43,7 @@ public class TiandituDownload {
2.68220901489258E-06,
1.34110450744629E-06
};
// 比例尺
double[] scale = {
400000000,
295497598.5708346,
......@@ -60,69 +65,83 @@ public class TiandituDownload {
4508.93552506767,
2254.467762533835,
1127.2338812669175,
563.616940
563.61694063345875
};
// 最小级别
int minLevel = 1;
// 最大级别
int maxLevel = 2;
// 保存数据的sqlite文件路径
String dbpath;
// SQLite链接
Connection conn = null;
Statement stmt = null;
public TiandituDownload(String dbpath){
this.dbpath =dbpath;
public TiandituDownload(String dbpath) {
this.dbpath = dbpath;
}
private CalEnv calculateEnv(Point originPoint, int level){
int startX = (int) Math.floor((originPoint.getLng() + 180)/(256 * res[level]));
int startY = (int) Math.floor((90 - originPoint.getLat())/(256 * res[level]));
if(startX<0)startX = 0;
if(startY<0)startY = 0;
/**
*
* @param originPoint 坐标点
* @param level 级别
* @return 改点在该级别所属的地图瓦片行列号
*/
private CalEnv calculateEnv(Point originPoint, int level) {
int startX = (int) Math.floor((originPoint.getLng() + 180) / (256 * res[level]));
int startY = (int) Math.floor((90 - originPoint.getLat()) / (256 * res[level]));
if (startX < 0) startX = 0;
if (startY < 0) startY = 0;
return new CalEnv(startX, startY);
}
private void Download(Point minPoint, Point maxPoint, int level, TianDiTuTiledMapServiceType type, boolean merge){
/**
*
* @param minPoint 下载范围左下角坐标
* @param maxPoint 下载范围右上角坐标
* @param level 下载级别
* @param type 下载数据类型
* @param merge 数据与其注记是否融合
*/
private void downloadSingLevelTiles(Point minPoint, Point maxPoint, int level, TianDiTuTiledMapServiceType type, boolean merge) {
try{
try {
CalEnv startEnv = calculateEnv(minPoint, level);
CalEnv stopEnv = calculateEnv(maxPoint, level);
// System.out.println(startEnv.getStartX() + ":" +startEnv.getStartY());
// System.out.println(stopEnv.getStartX() + ":" +stopEnv.getStartY());
PreparedStatement preparedStatement;
ResultSet rs;
for(int i = startEnv.getStartX(); i <= stopEnv.getStartX(); i++){
for(int j = stopEnv.getStartY(); j<= startEnv.getStartY(); j++){
for (int i = startEnv.getStartCol(); i <= stopEnv.getStartCol(); i++) {
for (int j = stopEnv.getStartRow(); j <= startEnv.getStartRow(); j++) {
boolean hasData = false;
try{
try {
// 查询瓦片是否存在
String querySQL = "select * from " + type + " where TILELEVEL = " + level + " and TILECOL = " + i + " and TILEROW = " + j;
rs = stmt.executeQuery(querySQL);
while(rs.next()){
while (rs.next()) {
hasData = true;
}
// 如果不存在
if(!hasData){
// 如果不存在则从网络获取
if (!hasData) {
String url = new TDTUrl(level, i, j, type).generatUrl();
// 获得地图瓦片
// 获得地图瓦片数据流
byte[] img = getTile(url);
System.out.println("正在下载 "+url);
System.out.println("正在下载 " + url);
// 如果merge为true,则在下载img_c或vec_c时将其注记图片一并下载
if(merge) {
if (merge) {
InputStream img_stream = new ByteArrayInputStream(img);
BufferedImage bImageFromConvert = ImageIO.read(img_stream);
String url2 = "";
if(type == TianDiTuTiledMapServiceType.IMG_C) {
if (type == TianDiTuTiledMapServiceType.IMG_C) {
url2 = new TDTUrl(level, i, j, TianDiTuTiledMapServiceType.CIA_C).generatUrl();
}else{
} else {
url2 = new TDTUrl(level, i, j, TianDiTuTiledMapServiceType.CVA_C).generatUrl();
}
byte[] img2 = getTile(url2);
......@@ -140,7 +159,7 @@ public class TiandituDownload {
baos.close();
}
// 将数据写入sqlite
String insertSQL = "INSERT INTO "+ type + "(TILELEVEL,TILECOL,TILEROW,TILEDATA) VALUES (?,?,?,?)";
String insertSQL = "INSERT INTO " + type + "(TILELEVEL,TILECOL,TILEROW,TILEDATA) VALUES (?,?,?,?)";
preparedStatement = conn.prepareStatement(insertSQL);
preparedStatement.setInt(1, level);
preparedStatement.setInt(2, i);
......@@ -148,17 +167,27 @@ public class TiandituDownload {
preparedStatement.setBytes(4, img);
preparedStatement.execute();
}
}catch (Exception e){
} catch (Exception e) {
System.out.println(e.getMessage());
}
}
conn.commit();
}
}catch (Exception e){
} catch (Exception e) {
System.out.println(e.getMessage());
}
}
/**
*
* @param minPoint 下载范围左下角坐标
* @param maxPoint 下载范围右上角坐标
* @param minLevel 下载最小级别
* @param maxLevel 下载最大级别
* @param type 下载数据类型
* @param merge 数据与其注记是否融合
* @throws SQLException
*/
public void Download(Point minPoint, Point maxPoint, int minLevel, int maxLevel, TianDiTuTiledMapServiceType type, boolean merge) throws SQLException {
try {
Class.forName("org.sqlite.JDBC");
......@@ -174,17 +203,23 @@ public class TiandituDownload {
stmt.executeUpdate(sql);
stmt.close();
for(int m = minLevel; m<= maxLevel; m++){
this.Download(minPoint, maxPoint, m, type, merge);
for (int m = minLevel; m <= maxLevel; m++) {
this.downloadSingLevelTiles(minPoint, maxPoint, m, type, merge);
}
conn.close();
System.out.println("下载完成");
}catch (Exception e){
} catch (Exception e) {
}
}
/**
* 下载网络数据
* @param url
* @return 图片数据流
* @throws Exception
*/
protected byte[] getTile(String url) throws Exception {
byte[] result = null;
try {
......
package utils;
/**
* 范围计算后的Row与Col类
*/
public class CalEnv {
private int startX;
private int startCol;
private int startY;
private int startRow;
public CalEnv(int startX, int startY) {
this.startX = startX;
this.startY = startY;
this.startCol = startX;
this.startRow = startY;
}
public int getStartX() {
return startX;
public int getStartCol() {
return startCol;
}
public void setStartX(int startX) {
this.startX = startX;
public void setStartCol(int startCol) {
this.startCol = startCol;
}
public int getStartY() {
return startY;
public int getStartRow() {
return startRow;
}
public void setStartY(int startY) {
this.startY = startY;
public void setStartRow(int startRow) {
this.startRow = startRow;
}
}
......
package utils;
/**
* 坐标点类
*/
public class Point {
private double lat;
......