├── TrafficSpider
├── GetTiles
│ ├── GetTiles.ashx
│ ├── Web.config
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── Web.Debug.config
│ └── Web.Release.config
├── app
│ ├── Resources
│ │ ├── bing.PNG
│ │ ├── tms.jpg
│ │ ├── Google.png
│ │ ├── google.ico
│ │ ├── WMS_icon.png
│ │ ├── download.png
│ │ ├── osm_logo.png
│ │ └── brutilelogobig.png
│ ├── lib
│ │ ├── SmartThreadPool.dll
│ │ ├── OsmMapType.cs
│ │ ├── SqlServer
│ │ │ └── Microsoft.ExceptionMessageBox.dll
│ │ ├── IConfig.cs
│ │ ├── EnumBruTileLayer.cs
│ │ ├── Tile.cs
│ │ ├── ConfigWmsC.cs
│ │ ├── ArcMapWindow.cs
│ │ ├── Projector.cs
│ │ ├── ConfigBingHybrid.cs
│ │ ├── ConfigOsm.cs
│ │ ├── ConfigBing.cs
│ │ ├── EnvelopeExtensionMethods.cs
│ │ ├── TileMap.cs
│ │ ├── Requester.cs
│ │ ├── ConfigTms.cs
│ │ ├── ConfigInvertedTMS.cs
│ │ ├── ConfigurationHelper.cs
│ │ ├── MultipleThreadResetEvent.cs
│ │ ├── TmsTileMapServiceParser.cs
│ │ ├── ConfigHelper.cs
│ │ ├── WorldFileWriter.cs
│ │ ├── CacheDirectory.cs
│ │ ├── CacheSettings.cs
│ │ ├── FileCacheExtensionMethods.cs
│ │ ├── FetchStrategy.cs
│ │ ├── Transform.cs
│ │ └── SimpleFileFetcher.cs
│ ├── brutile
│ │ └── 0.8.6
│ │ │ ├── BruTile.dll
│ │ │ └── BruTile.Desktop.dll
│ ├── packages.config
│ ├── MenuDefs
│ │ ├── PdokMenuDef.cs
│ │ ├── DutchMenu.cs
│ │ ├── StamenMenuDef.cs
│ │ ├── OsmMenuDef.cs
│ │ ├── MapQuestMenuDef.cs
│ │ ├── BingMenuDef.cs
│ │ ├── BruTileMenuDef.cs
│ │ ├── MapBoxMenuDef.cs
│ │ └── CloudMadeMenuDef.cs
│ ├── commands
│ │ ├── AddOsmLayerCommand.cs
│ │ ├── AddMapQuestLayerCommand.cs
│ │ ├── AddPdokLayerCommand.cs
│ │ ├── AddBingLayerCommand.cs
│ │ ├── AboutPdokCommand.cs
│ │ ├── AddStamenLayerCommand.cs
│ │ ├── AddMapBoxLayerCommand.cs
│ │ ├── AddCloudMadeLayerCommand.cs
│ │ ├── AboutBruTileCommand.cs
│ │ ├── AddBruTileLayerCommandBase.cs
│ │ ├── AddTmsLayerCommandBase.cs
│ │ ├── AddWmsCLayerCommand.cs
│ │ └── AddServicesCommand.cs
│ ├── services
│ │ └── arcbrutile_sample_services.xml
│ ├── ArcBruTileInstaller.Designer.cs
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── forms
│ │ ├── AddWmsCForm.cs
│ │ └── FormPreCacheStatus.Designer.cs
│ ├── App.config
│ └── ArcBruTileInstaller.cs
├── packages
│ ├── log4net.1.2.10
│ │ ├── lib
│ │ │ ├── 1.0
│ │ │ │ └── log4net.dll
│ │ │ ├── 1.1
│ │ │ │ └── log4net.dll
│ │ │ └── 2.0
│ │ │ │ └── log4net.dll
│ │ └── log4net.1.2.10.nupkg
│ └── SmartThreadPool.dll.2.2.3
│ │ ├── lib
│ │ └── SmartThreadPool.dll
│ │ └── SmartThreadPool.dll.2.2.3.nupkg
├── BruTile
│ ├── Wms
│ │ ├── Schema
│ │ │ ├── 1.0.0
│ │ │ │ └── Web_Map_Service_WMS1.pdf
│ │ │ ├── 1.1.0
│ │ │ │ ├── 01-047r2_Web_Map_Service_Implementation_Specification(1).pdf
│ │ │ │ ├── exception_1_1_0.dtd
│ │ │ │ └── exception_1_1_0.xml
│ │ │ ├── 1.1.1
│ │ │ │ ├── 01-068r3_Web_Map_Service_Implementation_Specification(1).pdf
│ │ │ │ ├── WMS_exception_1_1_1.dtd
│ │ │ │ ├── exception_1_1_1.dtd
│ │ │ │ ├── exception_1_1_1.xml
│ │ │ │ └── WMS_DescribeLayerResponse.dtd
│ │ │ ├── 1.3.0
│ │ │ │ ├── 06-042_OpenGIS_Web_Map_Service_WMS_Implementation_Specification.pdf
│ │ │ │ ├── exceptions_1_3_0.xml
│ │ │ │ └── exceptions_1_3_0.xsd
│ │ │ └── ReadMe.txt
│ │ ├── ServiceName.cs
│ │ ├── Get.cs
│ │ ├── Post.cs
│ │ ├── WmsParsingException.cs
│ │ ├── WmsPropertyException.cs
│ │ ├── DCPType.cs
│ │ ├── ServiceExceptionReport.cs
│ │ ├── Keyword.cs
│ │ ├── Exception.cs
│ │ ├── Identifier.cs
│ │ ├── OnlineResource.cs
│ │ ├── DCPTypeElement.cs
│ │ ├── ServiceException.cs
│ │ ├── StyleURL.cs
│ │ ├── StyleSheetURL.cs
│ │ ├── AuthorityURL.cs
│ │ ├── MetadataURL.cs
│ │ └── KeywordList.cs
│ ├── Program.cs
│ ├── ITileProvider.cs
│ ├── TileInfo.cs
│ ├── Cache
│ │ ├── IMemoryCache.cs
│ │ ├── IPersistentCache.cs
│ │ ├── NullCache.cs
│ │ └── ITileCache.cs
│ ├── Wmts
│ │ ├── ResourceUrl.cs
│ │ ├── how_wmts_classes_were_generated.txt
│ │ ├── xsd
│ │ │ ├── owsAll.xsd
│ │ │ ├── wmts.xsd
│ │ │ ├── wmtsGetCapabilities_request.xsd
│ │ │ ├── wmtsGetFeatureInfo_request.xsd
│ │ │ ├── owsServiceProvider.xsd
│ │ │ ├── wmtsPayload_response.xsd
│ │ │ └── wmtsGetFeatureInfo_response.xsd
│ │ ├── ScaleSetItem.cs
│ │ ├── WmtsRequest.cs
│ │ ├── ScaleSet.cs
│ │ └── CrsIdentifier.cs
│ ├── ValidationException.cs
│ ├── PreDefined
│ │ ├── BingSchema.cs
│ │ ├── SphericalMercatorInvertedWorldSchema.cs
│ │ ├── WkstNederlandSchema.cs
│ │ └── SphericalMercatorWorldSchema.cs
│ ├── Web
│ │ ├── WebResponseFormatException.cs
│ │ ├── BingTileSource.cs
│ │ ├── IRequest.cs
│ │ ├── ArcGisTileSource.cs
│ │ ├── WebTileProvider.cs
│ │ ├── HttpTileSource.cs
│ │ ├── OsmTileSource.cs
│ │ └── ArcGisTileRequest.cs
│ ├── TileMatrix.cs
│ ├── Resolution.cs
│ ├── ITileSource.cs
│ ├── ITileSchema.cs
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── Tms
│ │ ├── TmsTileSource.cs
│ │ ├── TileMapService.cs
│ │ └── Root.cs
│ ├── TileSource.cs
│ ├── TileRange.cs
│ └── TileIndex.cs
├── BruTile.Desktop
│ ├── Program.cs
│ ├── FileSystem
│ │ └── FileTileProvider.cs
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ └── Web
│ │ └── GoogleTileSource.cs
└── DownloadTiles
│ ├── Properties
│ ├── Settings.settings
│ ├── AssemblyInfo.cs
│ ├── Settings.Designer.cs
│ └── Resources.Designer.cs
│ ├── ConfigHelper.cs
│ ├── App.config
│ ├── LogManager.cs
│ └── Program.cs
├── README.md
├── .gitattributes
└── .gitignore
/TrafficSpider/GetTiles/GetTiles.ashx:
--------------------------------------------------------------------------------
1 | <%@ WebHandler Language="C#" CodeBehind="GetTiles.ashx.cs" Class="GetTiles.GetTiles" %>
2 |
--------------------------------------------------------------------------------
/TrafficSpider/app/Resources/bing.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaoqqchen/TrafficSpider/HEAD/TrafficSpider/app/Resources/bing.PNG
--------------------------------------------------------------------------------
/TrafficSpider/app/Resources/tms.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaoqqchen/TrafficSpider/HEAD/TrafficSpider/app/Resources/tms.jpg
--------------------------------------------------------------------------------
/TrafficSpider/app/Resources/Google.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaoqqchen/TrafficSpider/HEAD/TrafficSpider/app/Resources/Google.png
--------------------------------------------------------------------------------
/TrafficSpider/app/Resources/google.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaoqqchen/TrafficSpider/HEAD/TrafficSpider/app/Resources/google.ico
--------------------------------------------------------------------------------
/TrafficSpider/app/Resources/WMS_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaoqqchen/TrafficSpider/HEAD/TrafficSpider/app/Resources/WMS_icon.png
--------------------------------------------------------------------------------
/TrafficSpider/app/Resources/download.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaoqqchen/TrafficSpider/HEAD/TrafficSpider/app/Resources/download.png
--------------------------------------------------------------------------------
/TrafficSpider/app/Resources/osm_logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaoqqchen/TrafficSpider/HEAD/TrafficSpider/app/Resources/osm_logo.png
--------------------------------------------------------------------------------
/TrafficSpider/app/lib/SmartThreadPool.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaoqqchen/TrafficSpider/HEAD/TrafficSpider/app/lib/SmartThreadPool.dll
--------------------------------------------------------------------------------
/TrafficSpider/app/brutile/0.8.6/BruTile.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaoqqchen/TrafficSpider/HEAD/TrafficSpider/app/brutile/0.8.6/BruTile.dll
--------------------------------------------------------------------------------
/TrafficSpider/app/Resources/brutilelogobig.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaoqqchen/TrafficSpider/HEAD/TrafficSpider/app/Resources/brutilelogobig.png
--------------------------------------------------------------------------------
/TrafficSpider/app/lib/OsmMapType.cs:
--------------------------------------------------------------------------------
1 | namespace BrutileArcGIS.Lib
2 | {
3 | public enum OsmMapType
4 | {
5 | Default = 0
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/TrafficSpider/app/brutile/0.8.6/BruTile.Desktop.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaoqqchen/TrafficSpider/HEAD/TrafficSpider/app/brutile/0.8.6/BruTile.Desktop.dll
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # TrafficSpider
2 | 抓取矢量交通流量数据
3 | 主要功能是抓取实时的交通流量切片(以高德为例),并且把栅格切片转成矢量数据。
4 |
5 | 文章地址:http://www.cnblogs.com/pengchen/p/4770999.html
6 |
7 | 还没有整理好...
8 |
--------------------------------------------------------------------------------
/TrafficSpider/packages/log4net.1.2.10/lib/1.0/log4net.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaoqqchen/TrafficSpider/HEAD/TrafficSpider/packages/log4net.1.2.10/lib/1.0/log4net.dll
--------------------------------------------------------------------------------
/TrafficSpider/packages/log4net.1.2.10/lib/1.1/log4net.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaoqqchen/TrafficSpider/HEAD/TrafficSpider/packages/log4net.1.2.10/lib/1.1/log4net.dll
--------------------------------------------------------------------------------
/TrafficSpider/packages/log4net.1.2.10/lib/2.0/log4net.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaoqqchen/TrafficSpider/HEAD/TrafficSpider/packages/log4net.1.2.10/lib/2.0/log4net.dll
--------------------------------------------------------------------------------
/TrafficSpider/packages/log4net.1.2.10/log4net.1.2.10.nupkg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaoqqchen/TrafficSpider/HEAD/TrafficSpider/packages/log4net.1.2.10/log4net.1.2.10.nupkg
--------------------------------------------------------------------------------
/TrafficSpider/BruTile/Wms/Schema/1.0.0/Web_Map_Service_WMS1.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaoqqchen/TrafficSpider/HEAD/TrafficSpider/BruTile/Wms/Schema/1.0.0/Web_Map_Service_WMS1.pdf
--------------------------------------------------------------------------------
/TrafficSpider/app/lib/SqlServer/Microsoft.ExceptionMessageBox.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaoqqchen/TrafficSpider/HEAD/TrafficSpider/app/lib/SqlServer/Microsoft.ExceptionMessageBox.dll
--------------------------------------------------------------------------------
/TrafficSpider/app/lib/IConfig.cs:
--------------------------------------------------------------------------------
1 | using BruTile;
2 |
3 | namespace BrutileArcGIS.Lib
4 | {
5 | public interface IConfig
6 | {
7 | ITileSource CreateTileSource();
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/TrafficSpider/packages/SmartThreadPool.dll.2.2.3/lib/SmartThreadPool.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaoqqchen/TrafficSpider/HEAD/TrafficSpider/packages/SmartThreadPool.dll.2.2.3/lib/SmartThreadPool.dll
--------------------------------------------------------------------------------
/TrafficSpider/packages/SmartThreadPool.dll.2.2.3/SmartThreadPool.dll.2.2.3.nupkg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaoqqchen/TrafficSpider/HEAD/TrafficSpider/packages/SmartThreadPool.dll.2.2.3/SmartThreadPool.dll.2.2.3.nupkg
--------------------------------------------------------------------------------
/TrafficSpider/BruTile/Wms/Schema/1.1.0/01-047r2_Web_Map_Service_Implementation_Specification(1).pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaoqqchen/TrafficSpider/HEAD/TrafficSpider/BruTile/Wms/Schema/1.1.0/01-047r2_Web_Map_Service_Implementation_Specification(1).pdf
--------------------------------------------------------------------------------
/TrafficSpider/BruTile/Wms/Schema/1.1.1/01-068r3_Web_Map_Service_Implementation_Specification(1).pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaoqqchen/TrafficSpider/HEAD/TrafficSpider/BruTile/Wms/Schema/1.1.1/01-068r3_Web_Map_Service_Implementation_Specification(1).pdf
--------------------------------------------------------------------------------
/TrafficSpider/app/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/TrafficSpider/BruTile/Wms/Schema/1.3.0/06-042_OpenGIS_Web_Map_Service_WMS_Implementation_Specification.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xiaoqqchen/TrafficSpider/HEAD/TrafficSpider/BruTile/Wms/Schema/1.3.0/06-042_OpenGIS_Web_Map_Service_WMS_Implementation_Specification.pdf
--------------------------------------------------------------------------------
/TrafficSpider/app/lib/EnumBruTileLayer.cs:
--------------------------------------------------------------------------------
1 | namespace BrutileArcGIS.Lib
2 | {
3 | public enum EnumBruTileLayer
4 | {
5 | OSM,
6 | BingRoad, BingAerial, BingHybrid,
7 | TMS,
8 | WMSC,
9 | InvertedTMS
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/TrafficSpider/BruTile/Wms/Schema/1.1.0/exception_1_1_0.dtd:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/TrafficSpider/BruTile/Wms/Schema/1.1.1/WMS_exception_1_1_1.dtd:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/TrafficSpider/BruTile/Wms/Schema/1.1.1/exception_1_1_1.dtd:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/TrafficSpider/BruTile/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace BruTile
7 | {
8 | class Program
9 | {
10 | static void Main(string[] args)
11 | {
12 | }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/TrafficSpider/BruTile/ITileProvider.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) BruTile developers team. All rights reserved. See License.txt in the project root for license information.
2 |
3 | namespace BruTile
4 | {
5 | public interface ITileProvider
6 | {
7 | byte[] GetTile(TileInfo tileInfo);
8 | }
9 | }
--------------------------------------------------------------------------------
/TrafficSpider/BruTile/Wms/ServiceName.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) BruTile developers team. All rights reserved. See License.txt in the project root for license information.
2 |
3 | namespace BruTile.Wms
4 | {
5 | public enum ServiceName
6 | {
7 | ///
8 | WMS,
9 | }
10 | }
--------------------------------------------------------------------------------
/TrafficSpider/BruTile.Desktop/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace BruTile.Desktop
7 | {
8 | class Program
9 | {
10 | static void Main(string[] args)
11 | {
12 | }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/TrafficSpider/DownloadTiles/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/TrafficSpider/GetTiles/Web.config:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/TrafficSpider/app/lib/Tile.cs:
--------------------------------------------------------------------------------
1 | using BruTile;
2 |
3 | namespace BrutileArcGIS.lib
4 | {
5 | public class Tile
6 | {
7 | public TileInfo Info { get; set; }
8 | public T Image { get; set; }
9 | public long StartAnimation { get; set; }
10 | public byte[] Data { get; set; }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/TrafficSpider/BruTile/TileInfo.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) BruTile developers team. All rights reserved. See License.txt in the project root for license information.
2 |
3 | namespace BruTile
4 | {
5 | public class TileInfo
6 | {
7 | public TileIndex Index { get; set; }
8 | public Extent Extent { get; set; }
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/TrafficSpider/BruTile/Cache/IMemoryCache.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) BruTile developers team. All rights reserved. See License.txt in the project root for license information.
2 |
3 | namespace BruTile.Cache
4 | {
5 | interface IMemoryCache : ITileCache
6 | {
7 | int MinTiles { get; set; }
8 | int MaxTiles { get; set; }
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/TrafficSpider/app/MenuDefs/PdokMenuDef.cs:
--------------------------------------------------------------------------------
1 | using BrutileArcGIS.commands;
2 | using ESRI.ArcGIS.ADF.BaseClasses;
3 | namespace BrutileArcGIS.MenuDefs
4 | {
5 | public class PdokMenuDef:BaseMenu
6 | {
7 | public PdokMenuDef()
8 | {
9 | m_barCaption = "&PDOK";
10 | AddItem(typeof(AddPdokBrtAchtergrondLayerCommand));
11 | AddItem(typeof(AddPdokBrpGewaspercelenLayerCommand));
12 | }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/TrafficSpider/app/lib/ConfigWmsC.cs:
--------------------------------------------------------------------------------
1 | using BruTile;
2 |
3 | namespace BrutileArcGIS.Lib
4 | {
5 | public class ConfigWmsC: IConfig
6 | {
7 | private readonly ITileSource _tileSource;
8 |
9 | public ConfigWmsC(ITileSource tileSource)
10 | {
11 | _tileSource = tileSource;
12 | }
13 |
14 | public ITileSource CreateTileSource()
15 | {
16 | return _tileSource;
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/TrafficSpider/BruTile/Wmts/ResourceUrl.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) BruTile developers team. All rights reserved. See License.txt in the project root for license information.
2 |
3 | using BruTile.Wmts.Generated;
4 |
5 | namespace BruTile.Wmts
6 | {
7 | public class ResourceUrl
8 | {
9 | public string Format { get; set; }
10 | public URLTemplateTypeResourceType ResourceType { get; set; }
11 | public string Template { get; set; }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/TrafficSpider/BruTile/Wms/Get.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) BruTile developers team. All rights reserved. See License.txt in the project root for license information.
2 |
3 | using System.Xml.Linq;
4 |
5 | namespace BruTile.Wms
6 | {
7 | public class Get : DCPTypeElement
8 | {
9 | public Get()
10 | : base("Get")
11 | {
12 | }
13 |
14 | public Get(XElement node, string @namespace)
15 | : base("Get", node, @namespace)
16 | { }
17 | }
18 | }
--------------------------------------------------------------------------------
/TrafficSpider/app/MenuDefs/DutchMenu.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using BrutileArcGIS.commands;
6 | using ESRI.ArcGIS.ADF.BaseClasses;
7 |
8 | namespace BrutileArcGIS.MenuDefs
9 | {
10 | public class DutchMenuDef:BaseMenu
11 | {
12 | public DutchMenuDef()
13 | {
14 | m_barCaption = "ArcBruTile - &Dutch";
15 | AddItem(typeof (AboutBruTileCommand));
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/TrafficSpider/BruTile/Wms/Post.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) BruTile developers team. All rights reserved. See License.txt in the project root for license information.
2 |
3 | using System.Xml.Linq;
4 |
5 | namespace BruTile.Wms
6 | {
7 | public class Post : DCPTypeElement
8 | {
9 | public Post()
10 | : base("Post")
11 | {
12 | }
13 |
14 | public Post(XElement node, string @namespace)
15 | : base("Post", node, @namespace)
16 | { }
17 | }
18 | }
--------------------------------------------------------------------------------
/TrafficSpider/app/lib/ArcMapWindow.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using ESRI.ArcGIS.Framework;
3 |
4 | namespace BrutileArcGIS.Lib
5 | {
6 | public class ArcMapWindow : System.Windows.Forms.IWin32Window
7 | {
8 | private readonly IApplication _app;
9 |
10 | public ArcMapWindow(IApplication application)
11 | {
12 | _app = application;
13 | }
14 |
15 | public IntPtr Handle
16 | {
17 | get { return new IntPtr(_app.hWnd); }
18 | }
19 | }
20 | }
--------------------------------------------------------------------------------
/TrafficSpider/app/lib/Projector.cs:
--------------------------------------------------------------------------------
1 | using ESRI.ArcGIS.Geometry;
2 |
3 | namespace BrutileArcGIS.Lib
4 | {
5 | public class Projector
6 | {
7 | public static IEnvelope ProjectEnvelope(IEnvelope envelope, string srs)
8 | {
9 | var spatialReferences = new SpatialReferences();
10 | var dataSpatialReference = spatialReferences.GetSpatialReference(srs);
11 | envelope.Project(dataSpatialReference);
12 | return envelope;
13 | }
14 |
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/TrafficSpider/app/MenuDefs/StamenMenuDef.cs:
--------------------------------------------------------------------------------
1 | using BrutileArcGIS.commands;
2 | using ESRI.ArcGIS.ADF.BaseClasses;
3 |
4 | namespace BrutileArcGIS.MenuDefs
5 | {
6 | public class StamenMenuDef : BaseMenu
7 | {
8 | public StamenMenuDef()
9 | {
10 | m_barCaption = "&Stamen";
11 | AddItem(typeof(AddStamenWaterColorLayerCommand));
12 | AddItem(typeof(AddStamenTerrainLayerCommand));
13 | AddItem(typeof(AddStamenTonerLayerCommand));
14 | }
15 | }
16 | }
17 |
18 |
--------------------------------------------------------------------------------
/TrafficSpider/app/commands/AddOsmLayerCommand.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 | using BrutileArcGIS.Lib;
3 | using BrutileArcGIS.Properties;
4 |
5 | namespace BrutileArcGIS.commands
6 | {
7 | [ProgId("AddOsmLayerCommand1")]
8 | public sealed class AddOsmLayerCommand : AddBruTileLayerCommandBase
9 | {
10 | public AddOsmLayerCommand()
11 | : base("BruTile", "&Mapnik", "Add OpenStreetMap Layer", "OpenStreetMap Mapnik", Resources.osm_logo, EnumBruTileLayer.OSM)
12 | {
13 | }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/TrafficSpider/BruTile/Cache/IPersistentCache.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) BruTile developers team. All rights reserved. See License.txt in the project root for license information.
2 |
3 | namespace BruTile.Cache
4 | {
5 | ///
6 | /// All caches that touch the disk (e.g.: FileCache, DbCache and MBTilesCache) should be derived
7 | /// from IPersistentCache so that it can be used in an interface where only a persistent cache
8 | /// would make sense
9 | ///
10 | public interface IPersistentCache : ITileCache
11 | {
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | * text=auto
3 |
4 | # Custom for Visual Studio
5 | *.cs diff=csharp
6 | *.sln merge=union
7 | *.csproj merge=union
8 | *.vbproj merge=union
9 | *.fsproj merge=union
10 | *.dbproj merge=union
11 |
12 | # Standard to msysgit
13 | *.doc diff=astextplain
14 | *.DOC diff=astextplain
15 | *.docx diff=astextplain
16 | *.DOCX diff=astextplain
17 | *.dot diff=astextplain
18 | *.DOT diff=astextplain
19 | *.pdf diff=astextplain
20 | *.PDF diff=astextplain
21 | *.rtf diff=astextplain
22 | *.RTF diff=astextplain
23 |
--------------------------------------------------------------------------------
/TrafficSpider/BruTile/ValidationException.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) BruTile developers team. All rights reserved. See License.txt in the project root for license information.
2 |
3 | using System;
4 |
5 | namespace BruTile
6 | {
7 |
8 | public class ValidationException : Exception
9 | {
10 | //todo: repace with some standard exception
11 | public ValidationException() { }
12 | public ValidationException(string message) : base(message) { }
13 | public ValidationException(string message, Exception innerException) : base(message, innerException) { }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/TrafficSpider/BruTile/PreDefined/BingSchema.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) BruTile developers team. All rights reserved. See License.txt in the project root for license information.
2 |
3 | using System;
4 |
5 | namespace BruTile.Predefined
6 | {
7 | [Obsolete("Use GlobalSphericalMercator(1) instead")]
8 | public class BingSchema : SphericalMercatorInvertedWorldSchema
9 | {
10 | public BingSchema()
11 | {
12 | Format = "jpg";
13 | Name = "BingMaps";
14 | Resolutions.Remove("0"); //Bing does not have the single tile top level.
15 | }
16 | }
17 | }
--------------------------------------------------------------------------------
/TrafficSpider/BruTile/Web/WebResponseFormatException.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) BruTile developers team. All rights reserved. See License.txt in the project root for license information.
2 |
3 | using System;
4 | using System.Net;
5 |
6 | namespace BruTile.Web
7 | {
8 | public class WebResponseFormatException : WebException
9 | {
10 | public WebResponseFormatException() { }
11 | public WebResponseFormatException(string message) : base(message) { }
12 | public WebResponseFormatException(string message, Exception innerException) : base(message, innerException) { }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/TrafficSpider/BruTile/TileMatrix.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) BruTile developers team. All rights reserved. See License.txt in the project root for license information.
2 | namespace BruTile
3 | {
4 | public class TileMatrix
5 | {
6 | public string Id { get; set; }
7 | public double ScaleDenominator { get; set; }
8 | public double Top { get; set; }
9 | public double Left { get; set; }
10 | public int TileWidth { get; set; }
11 | public int TileHeight { get; set; }
12 | public int MatrixWidth { get; set; }
13 | public int MatrixHeight { get; set; }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/TrafficSpider/BruTile/PreDefined/SphericalMercatorInvertedWorldSchema.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) BruTile developers team. All rights reserved. See License.txt in the project root for license information.
2 |
3 | using System;
4 |
5 | namespace BruTile.Predefined
6 | {
7 | [Obsolete("Use GlobalSphericalMercator instead")]
8 | public class SphericalMercatorInvertedWorldSchema : SphericalMercatorWorldSchema
9 | {
10 | public SphericalMercatorInvertedWorldSchema()
11 | {
12 | YAxis = YAxis.OSM;
13 | OriginY = -OriginY;
14 | Name = "WorldSphericalMercatorInverted";
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/TrafficSpider/app/lib/ConfigBingHybrid.cs:
--------------------------------------------------------------------------------
1 | using BruTile;
2 | using BruTile.Web;
3 |
4 | namespace BrutileArcGIS.Lib
5 | {
6 | public class ConfigBingHybrid : IConfig
7 | {
8 | public ITileSource CreateTileSource()
9 | {
10 | var config = ConfigurationHelper.GetConfig();
11 |
12 | var bingToken = config.AppSettings.Settings["BingToken"].Value;
13 | var bingUrl = config.AppSettings.Settings["BingUrl"].Value;
14 | const BingMapType mapType = BingMapType.Hybrid;
15 |
16 | return new BingTileSource(
17 | bingUrl, bingToken, mapType);
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/TrafficSpider/BruTile/Cache/NullCache.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) BruTile developers team. All rights reserved. See License.txt in the project root for license information.
2 |
3 | using System;
4 |
5 | namespace BruTile.Cache
6 | {
7 | public class NullCache : IPersistentCache
8 | {
9 | public void Add(TileIndex index, byte[] image)
10 | {
11 | //do nothing
12 | }
13 |
14 | public void Remove(TileIndex index)
15 | {
16 | throw new NotImplementedException(); //and should not
17 | }
18 |
19 | public byte[] Find(TileIndex index)
20 | {
21 | return null;
22 | }
23 | }
24 | }
--------------------------------------------------------------------------------
/TrafficSpider/app/lib/ConfigOsm.cs:
--------------------------------------------------------------------------------
1 | using BruTile;
2 | using BruTile.Web;
3 |
4 | namespace BrutileArcGIS.Lib
5 | {
6 | public class ConfigOsm : IConfig
7 | {
8 | private readonly OsmMapType _osmMapType;
9 |
10 | public ConfigOsm(OsmMapType maptype)
11 | {
12 | _osmMapType = maptype;
13 |
14 | }
15 |
16 | public ITileSource CreateTileSource()
17 | {
18 | ITileSource result = null;
19 |
20 | if (_osmMapType == OsmMapType.Default)
21 | {
22 | result= new OsmTileSource();
23 | }
24 |
25 | return result;
26 | }
27 | }
28 | }
29 |
30 |
--------------------------------------------------------------------------------
/TrafficSpider/BruTile/Resolution.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) BruTile developers team. All rights reserved. See License.txt in the project root for license information.
2 |
3 | using System;
4 | using System.Linq;
5 |
6 | namespace BruTile
7 | {
8 | public struct Resolution
9 | {
10 | public string Id { get; set; }
11 | public double UnitsPerPixel { get; set; }
12 | public double ScaleDenominator { get; set; }
13 | public double Top { get; set; }
14 | public double Left { get; set; }
15 | public int TileWidth { get; set; }
16 | public int TileHeight { get; set; }
17 | public int MatrixWidth { get; set; }
18 | public int MatrixHeight { get; set; }
19 | }
20 | }
--------------------------------------------------------------------------------
/TrafficSpider/app/lib/ConfigBing.cs:
--------------------------------------------------------------------------------
1 | using BruTile;
2 | using BruTile.Web;
3 |
4 | namespace BrutileArcGIS.Lib
5 | {
6 | public class ConfigBing : IConfig
7 | {
8 | private readonly BingMapType _mapType = BingMapType.Roads;
9 |
10 | public ConfigBing(BingMapType mapType)
11 | {
12 | _mapType = mapType;
13 | }
14 |
15 | public ITileSource CreateTileSource()
16 | {
17 | var config = ConfigurationHelper.GetConfig();
18 |
19 | var bingToken=config.AppSettings.Settings["BingToken"].Value;
20 | var bingUrl = config.AppSettings.Settings["BingUrl"].Value;
21 |
22 | return new BingTileSource(
23 | bingUrl,bingToken,_mapType);
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/TrafficSpider/app/MenuDefs/OsmMenuDef.cs:
--------------------------------------------------------------------------------
1 | using ESRI.ArcGIS.SystemUI;
2 |
3 | namespace BrutileArcGIS.MenuDefs
4 | {
5 | public class OsmMenuDef : IMenuDef
6 | {
7 | public string Caption
8 | {
9 | get { return "&OpenStreetMap"; }
10 | }
11 |
12 | public void GetItemInfo(int pos, IItemDef itemDef)
13 | {
14 | switch (pos)
15 | {
16 | case 0:
17 | itemDef.ID = "AddOsmLayerCommand1";
18 | itemDef.Group = false;
19 | break;
20 | }
21 | }
22 |
23 | public int ItemCount
24 | {
25 | get { return 1; }
26 | }
27 |
28 | public string Name
29 | {
30 | get { return "BruTile"; }
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/TrafficSpider/app/lib/EnvelopeExtensionMethods.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Drawing;
3 | using ESRI.ArcGIS.Geometry;
4 |
5 | namespace BrutileArcGIS.lib
6 | {
7 | public static class EnvelopeExtensionMethods
8 | {
9 | public static float GetMapResolution(this IEnvelope env, int mapWidth)
10 | {
11 | var dx = env.XMax - env.XMin;
12 | var res = Convert.ToSingle(dx / mapWidth);
13 | return res;
14 | }
15 |
16 |
17 | public static PointF GetCenterPoint(this IEnvelope env)
18 | {
19 | var p = new PointF
20 | {
21 | X = Convert.ToSingle(env.XMin + (env.XMax - env.XMin) / 2),
22 | Y = Convert.ToSingle(env.YMin + (env.YMax - env.YMin) / 2)
23 | };
24 | return p;
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/TrafficSpider/app/lib/TileMap.cs:
--------------------------------------------------------------------------------
1 | namespace BrutileArcGIS.Lib
2 | {
3 | public class TileMap
4 | {
5 | public TileMap()
6 | {
7 | OverwriteUrls = true;
8 | }
9 |
10 | public string Href { get; set; }
11 | public string Srs { get; set; }
12 | public string Title { get; set; }
13 | public string Profile { get; set; }
14 | public string Type { get; set; }
15 | public bool OverwriteUrls { get; set; }
16 |
17 | static public int Compare(TileMap a, TileMap b)
18 | {
19 | return(System.String.Compare(a.Title, b.Title, System.StringComparison.Ordinal));
20 | }
21 | }
22 |
23 | public class TileMapService
24 | {
25 | public string Title { get; set; }
26 | public string Version { get; set; }
27 | public string Href { get; set; }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/TrafficSpider/BruTile/Web/BingTileSource.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) BruTile developers team. All rights reserved. See License.txt in the project root for license information.
2 |
3 | using BruTile.Cache;
4 | using BruTile.Predefined;
5 | using System;
6 |
7 | namespace BruTile.Web
8 | {
9 | [Obsolete("Use KnownTileSources instead")]
10 | public class BingTileSource : TileSource
11 | {
12 | public BingTileSource(String url, string token, BingMapType mapType)
13 | : this(new BingRequest(url, token, mapType))
14 | {
15 | }
16 |
17 | public BingTileSource(
18 | BingRequest bingRequest,
19 | IPersistentCache persistentCache = null)
20 | : base(new WebTileProvider(bingRequest, persistentCache), new GlobalSphericalMercator("jpg", YAxis.OSM, 1, 19, "Bing"))
21 | {
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/TrafficSpider/BruTile/ITileSource.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) BruTile developers team. All rights reserved. See License.txt in the project root for license information.
2 |
3 | namespace BruTile
4 | {
5 | ///
6 | /// Interface for a tile source.
7 | ///
8 | /// A tile provider is tuple of and .
9 | public interface ITileSource
10 | {
11 | ///
12 | /// Gets a value indicating the tile provider
13 | ///
14 | ITileProvider Provider { get; }
15 |
16 | ///
17 | /// Gets a value indicating the tile schema
18 | ///
19 | ITileSchema Schema { get; }
20 |
21 | ///
22 | /// Gets a value indicating the title of the tile source
23 | ///
24 | string Name { get; }
25 | }
26 | }
--------------------------------------------------------------------------------
/TrafficSpider/app/lib/Requester.cs:
--------------------------------------------------------------------------------
1 | using System.Net;
2 | using System.Text;
3 | using System.Xml;
4 |
5 | namespace BrutileArcGIS.lib
6 | {
7 | public class Requester
8 | {
9 | public static XmlDocument GetXmlDocument(string url)
10 | {
11 | var client = new WebClient();
12 | client.Headers.Add("user-agent", "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14");
13 |
14 | var proxy = WebRequest.GetSystemWebProxy();
15 | proxy.Credentials = CredentialCache.DefaultCredentials;
16 | client.Proxy = proxy;
17 |
18 | var theBytes = client.DownloadData(url);
19 | var test = Encoding.UTF8.GetString(theBytes);
20 | client.Dispose();
21 | var doc = new XmlDocument();
22 | doc.LoadXml(test);
23 | return doc;
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/TrafficSpider/app/services/arcbrutile_sample_services.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/TrafficSpider/BruTile/Wmts/how_wmts_classes_were_generated.txt:
--------------------------------------------------------------------------------
1 | steps I have taken to generate the wmts classes that map the service response.
2 |
3 | 1) downloaded the wmts xsd's from: http://schemas.opengis.net/wmts/wmts-1_0_1.zip
4 | 2) these depend on ogc ows 1.1. So I downloaded the ows xsd's from: http://schemas.opengis.net/ows/ows-1_1_0.zip
5 | 3) these depend on w3c xlink, so I downloaded this from: http://www.w3.org/1999/xlink.xsd
6 | 4) I extracted all these and put them in the same directory
7 | 5) ran xsd.exe from the VS commond prompt. > xsd.exe xlink.xsd owscommon.xsd wmtsGetCapabilities_response.xsd /classes
8 | 6) added this to BruTile/Web/Wmts/Generated/ and got some errors
9 | 7) replaced XmlNode with XNode to fix a compile error
10 | 8) on 'public BoundingBoxType[] Items' I removed the WGS84BoundingBox attribute to fix an error in the code that xsd.exe generated.
11 | 9) on 'public Theme[][] Themes' I added '[]' after Theme in the attribute to fix an error in the code that xsd.exe generated.
12 |
13 |
--------------------------------------------------------------------------------
/TrafficSpider/app/MenuDefs/MapQuestMenuDef.cs:
--------------------------------------------------------------------------------
1 | using ESRI.ArcGIS.SystemUI;
2 |
3 | namespace BrutileArcGIS.MenuDefs
4 | {
5 | public class MapQuestMenuDef : IMenuDef
6 | {
7 | public string Caption
8 | {
9 | get { return "&MapQuest"; }
10 | }
11 | public void GetItemInfo(int pos, IItemDef itemDef)
12 | {
13 | switch (pos)
14 | {
15 | case 0:
16 | itemDef.ID = "AddMapQuestOpenAerialMapLayerCommand";
17 | itemDef.Group = false;
18 | break;
19 | case 1:
20 | itemDef.ID = "AddMapQuestOSMLayerCommand";
21 | itemDef.Group = false;
22 | break;
23 | }
24 | }
25 |
26 | public int ItemCount
27 | {
28 | get { return 2; }
29 | }
30 |
31 | public string Name
32 | {
33 | get { return "BruTile"; }
34 | }
35 | }
36 | }
--------------------------------------------------------------------------------
/TrafficSpider/BruTile/Wms/WmsParsingException.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) BruTile developers team. All rights reserved. See License.txt in the project root for license information.
2 |
3 | namespace BruTile.Wms
4 | {
5 | public class WmsParsingException : System.Exception
6 | {
7 | public WmsParsingException()
8 | { }
9 |
10 | public WmsParsingException(string message)
11 | : base(message)
12 | {
13 | }
14 |
15 | public WmsParsingException(string message, System.Exception inner)
16 | : base(message, inner)
17 | {
18 | }
19 |
20 | public static WmsParsingException AttributeNotFound(string attribute)
21 | {
22 | return new WmsParsingException(string.Format("'{0}' attribute not found", attribute));
23 | }
24 |
25 | public static WmsParsingException ElementNotFound(string element)
26 | {
27 | return new WmsParsingException(string.Format("'<{0}>' element not found", element));
28 | }
29 | }
30 | }
--------------------------------------------------------------------------------
/TrafficSpider/BruTile.Desktop/FileSystem/FileTileProvider.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) BruTile developers team. All rights reserved. See License.txt in the project root for license information.
2 |
3 | using System;
4 | using System.IO;
5 | using BruTile.Cache;
6 |
7 | namespace BruTile.FileSystem
8 | {
9 | public class FileTileProvider : ITileProvider
10 | {
11 | readonly FileCache _fileCache;
12 |
13 | public FileTileProvider(string directory, string format, TimeSpan cacheExpireTime)
14 | {
15 | _fileCache = new FileCache(directory, format, cacheExpireTime);
16 | }
17 |
18 | public FileTileProvider(FileCache fileCache)
19 | {
20 | _fileCache = fileCache;
21 | }
22 |
23 | public byte[] GetTile(TileInfo tileInfo)
24 | {
25 | byte[] bytes = _fileCache.Find(tileInfo.Index);
26 | if (bytes == null) throw new FileNotFoundException("The tile was not found at it's expected location");
27 | return bytes;
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/TrafficSpider/BruTile/Web/IRequest.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) BruTile developers team. All rights reserved. See License.txt in the project root for license information.
2 |
3 | using System;
4 |
5 | namespace BruTile.Web
6 | {
7 | public interface IRequest
8 | {
9 | ///
10 | /// Generates a URI at which to get the data for a tile.
11 | ///
12 | /// Information about a tile.
13 | /// The URI at which to get the data for the specified tile.
14 | Uri GetUri(TileInfo info);
15 | }
16 |
17 | ///
18 | /// NullRequest class is a placeholder for request builders for tile providers. It has no other use!
19 | ///
20 | public sealed class NullRequest : IRequest
21 | {
22 | internal NullRequest() {}
23 |
24 | public Uri GetUri(TileInfo info)
25 | {
26 | throw new NotSupportedException("NullRequest is a placeholder in order to instantiate tile providers.");
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/TrafficSpider/app/lib/ConfigTms.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Net;
3 | using BruTile;
4 | using BruTile.Tms;
5 |
6 | namespace BrutileArcGIS.Lib
7 | {
8 | public class ConfigTms: IConfig
9 | {
10 | private readonly bool _overwriteUrls;
11 |
12 | public ConfigTms(String url, bool overwriteUrls)
13 | {
14 | Url = url;
15 | _overwriteUrls = overwriteUrls;
16 | }
17 |
18 | public ITileSource CreateTileSource()
19 | {
20 | var request = (HttpWebRequest)WebRequest.Create(Url);
21 | request.UserAgent = "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14";
22 | var response = (HttpWebResponse)request.GetResponse();
23 | var stream= response.GetResponseStream();
24 | var tileSource = _overwriteUrls ? TileMapParser.CreateTileSource(stream, Url) : TileMapParser.CreateTileSource(stream);
25 | return tileSource;
26 | }
27 |
28 | public string Url { get; set; }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/TrafficSpider/app/commands/AddMapQuestLayerCommand.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 | using BrutileArcGIS.Lib;
3 | using BrutileArcGIS.Properties;
4 |
5 | namespace BrutileArcGIS.commands
6 | {
7 | [ProgId("AddMapQuestOpenAerialMapLayerCommand")]
8 | public sealed class AddMapQuestOpenAerialMapLayerCommand : AddTmsLayerCommandBase
9 | {
10 | public AddMapQuestOpenAerialMapLayerCommand()
11 | : base("BruTile", "&OpenAerialMap", "Add OpenAerialMap Layer", "MapQuest OpenAerialMap", Resources.download, "http://dl.dropbox.com/u/9984329/ArcBruTile/Services/MapQuest/OpenAerialMap.xml", EnumBruTileLayer.InvertedTMS)
12 | {
13 | }
14 | }
15 |
16 | [ProgId("AddMapQuestOSMLayerCommand")]
17 | public sealed class AddMapQuestOSMLayerCommand : AddTmsLayerCommandBase
18 | {
19 | public AddMapQuestOSMLayerCommand()
20 | : base("BruTile", "&OSM", "Add OSM Layer", "MapQuest OSM", Resources.download, "http://dl.dropbox.com/u/9984329/ArcBruTile/Services/MapQuest/OSM.xml", EnumBruTileLayer.InvertedTMS)
21 | {
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/TrafficSpider/BruTile/Web/ArcGisTileSource.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) BruTile developers team. All rights reserved. See License.txt in the project root for license information.
2 |
3 | // This file was created by Tim Ebben (Geodan) 2009
4 |
5 | using System;
6 | using System.Linq;
7 | using BruTile.Cache;
8 |
9 | namespace BruTile.Web
10 | {
11 | public class ArcGisTileSource : TileSource
12 | {
13 | public string BaseUrl { get; private set; }
14 |
15 | public ArcGisTileSource(
16 | string baseUrl,
17 | ITileSchema schema,
18 | IPersistentCache persistentCache = null,
19 | Func fetchTile = null)
20 | : base(
21 | new WebTileProvider(CreateArcGISRequest(baseUrl), persistentCache, fetchTile),
22 | schema)
23 | {
24 | BaseUrl = baseUrl;
25 | }
26 |
27 | private static IRequest CreateArcGISRequest(string baseUrl)
28 | {
29 | return new BasicRequest(string.Format("{0}/tile/{1}", baseUrl, "{0}/{2}/{1}"));
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/TrafficSpider/BruTile/ITileSchema.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) BruTile developers team. All rights reserved. See License.txt in the project root for license information.
2 |
3 | using System;
4 | using System.Collections.Generic;
5 |
6 | namespace BruTile
7 | {
8 | public interface ITileSchema
9 | {
10 | string Name { get; }
11 | string Srs { get; }
12 | Extent Extent { get; }
13 | int GetTileWidth(string levelId);
14 | int GetTileHeight(string levelId);
15 | double GetOriginX(string levelId);
16 | double GetOriginY(string levelId);
17 | int GetMatrixWidth(string levelId);
18 | int GetMatrixHeight(string levelId);
19 | IDictionary Resolutions { get; }
20 | string Format { get; }
21 | YAxis YAxis { get; }
22 | IEnumerable GetTilesInView(Extent extent, string levelId);
23 | IEnumerable GetTilesInView(Extent extent, double resolution);
24 | Extent GetExtentOfTilesInView(Extent extent, string levelId);
25 | int GetMatrixFirstCol(string levelId);
26 | int GetMatrixFirstRow(string levelId);
27 | }
28 | }
--------------------------------------------------------------------------------
/TrafficSpider/BruTile/Wms/WmsPropertyException.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) BruTile developers team. All rights reserved. See License.txt in the project root for license information.
2 |
3 | namespace BruTile.Wms
4 | {
5 | public class WmsPropertyException : System.Exception
6 | {
7 | public WmsPropertyException()
8 | {
9 | }
10 |
11 | public WmsPropertyException(string message)
12 | : base(message)
13 | {
14 | }
15 |
16 | public WmsPropertyException(string message, System.Exception inner)
17 | : base(message, inner)
18 | {
19 | }
20 |
21 | public static WmsPropertyException PositiveInteger(string property, int value)
22 | {
23 | return new WmsPropertyException(string.Format("{0} requires a positve integer value. You tried to assign {1}", property, value));
24 | }
25 |
26 | public static System.Exception NonNegativeInteger(string property, int value)
27 | {
28 | return new WmsPropertyException(string.Format("{0} requires a non-negative integer value. You tried to assign {1}", property, value));
29 | }
30 | }
31 | }
--------------------------------------------------------------------------------
/TrafficSpider/GetTiles/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // 有关程序集的常规信息通过以下特性集
6 | // 控制。更改这些特性值可修改
7 | // 与程序集关联的信息。
8 | [assembly: AssemblyTitle("GetTiles")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("http://www.deepbbs.org")]
12 | [assembly: AssemblyProduct("GetTiles")]
13 | [assembly: AssemblyCopyright("Copyright © http://www.deepbbs.org 2014")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // 将 ComVisible 设置为 false 会使此程序集中的类型
18 | // 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型,
19 | // 则将该类型上的 ComVisible 特性设置为 true。
20 | [assembly: ComVisible(false)]
21 |
22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
23 | [assembly: Guid("6d5812f6-f260-499a-9531-c3d40e46c9a1")]
24 |
25 | // 程序集的版本信息由下列四个值组成:
26 | //
27 | // 主版本
28 | // 次版本
29 | // 内部版本号
30 | // 修订号
31 | //
32 | // 您可以指定所有这些值,也可以使用“修订号”和“内部版本号”的默认值,
33 | // 方法是按如下所示使用“*”:
34 | [assembly: AssemblyVersion("1.0.0.0")]
35 | [assembly: AssemblyFileVersion("1.0.0.0")]
36 |
--------------------------------------------------------------------------------
/TrafficSpider/GetTiles/Web.Debug.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
17 |
18 |
29 |
30 |
--------------------------------------------------------------------------------
/TrafficSpider/app/MenuDefs/BingMenuDef.cs:
--------------------------------------------------------------------------------
1 | using ESRI.ArcGIS.SystemUI;
2 |
3 | namespace BrutileArcGIS.MenuDefs
4 | {
5 | public class BingMenuDef : IMenuDef
6 | {
7 | public string Caption
8 | {
9 | get { return "&Bing"; }
10 | }
11 | public void GetItemInfo(int pos, IItemDef itemDef)
12 | {
13 | switch (pos)
14 | {
15 | case 0:
16 | itemDef.ID = "AddBingRoadLayerCommand";
17 | itemDef.Group = false;
18 | break;
19 | case 1:
20 | itemDef.ID = "AddBingAerialLayerCommand";
21 | itemDef.Group = false;
22 | break;
23 | case 2:
24 | itemDef.ID = "AddBingHybridLayerCommand";
25 | itemDef.Group = false;
26 | break;
27 |
28 | }
29 | }
30 |
31 | public int ItemCount
32 | {
33 | get { return 3; }
34 | }
35 |
36 | public string Name
37 | {
38 | get { return "BruTile"; }
39 | }
40 | }
41 | }
42 |
43 |
--------------------------------------------------------------------------------
/TrafficSpider/app/MenuDefs/BruTileMenuDef.cs:
--------------------------------------------------------------------------------
1 | using ESRI.ArcGIS.SystemUI;
2 |
3 | namespace BrutileArcGIS.MenuDefs
4 | {
5 | public class BruTileMenuDef : IMenuDef
6 | {
7 | public string Caption
8 | {
9 | get { return "&ArcBruTile - Global"; }
10 | }
11 |
12 | public void GetItemInfo(int pos, IItemDef itemDef)
13 | {
14 | switch (pos)
15 | {
16 | case 0:
17 | itemDef.ID = "AddServicesCommand";
18 | itemDef.Group = false;
19 | break;
20 | //case 1:
21 | // itemDef.ID = "AddWmscCommand";
22 | // itemDef.Group = false;
23 | // break;
24 | case 1:
25 | itemDef.ID = "AboutBruTileCommand";
26 | itemDef.Group = true;
27 | break;
28 | }
29 | }
30 |
31 | public int ItemCount
32 | {
33 | get { return 2; }
34 | }
35 |
36 | public string Name
37 | {
38 | get { return "BruTile"; }
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/TrafficSpider/DownloadTiles/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // 有关程序集的常规信息通过以下
6 | // 特性集控制。更改这些特性值可修改
7 | // 与程序集关联的信息。
8 | [assembly: AssemblyTitle("DownloadTiles")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("DownloadTiles")]
13 | [assembly: AssemblyCopyright("Copyright © 2014")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // 将 ComVisible 设置为 false 使此程序集中的类型
18 | // 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型,
19 | // 则将该类型上的 ComVisible 特性设置为 true。
20 | [assembly: ComVisible(false)]
21 |
22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
23 | [assembly: Guid("487610e5-0ac9-4606-932b-e233615144f2")]
24 |
25 | // 程序集的版本信息由下面四个值组成:
26 | //
27 | // 主版本
28 | // 次版本
29 | // 内部版本号
30 | // 修订号
31 | //
32 | // 可以指定所有这些值,也可以使用“内部版本号”和“修订号”的默认值,
33 | // 方法是按如下所示使用“*”:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/TrafficSpider/BruTile/Wmts/xsd/owsAll.xsd:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 | owsAll.xsd
8 | This XML Schema Document includes and imports, directly and indirectly, all the XML Schemas defined by the OWS Common Implemetation Specification.
9 |
10 | OWS is an OGC Standard.
11 | Copyright (c) 2006,2010 Open Geospatial Consortium.
12 | To obtain additional rights of use, visit http://www.opengeospatial.org/legal/ .
13 |
14 |
15 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/TrafficSpider/app/MenuDefs/MapBoxMenuDef.cs:
--------------------------------------------------------------------------------
1 | using ESRI.ArcGIS.SystemUI;
2 |
3 | namespace BrutileArcGIS.MenuDefs
4 | {
5 | public class MapBoxMenuDef : IMenuDef
6 | {
7 | public string Caption
8 | {
9 | get { return "&MapBox"; }
10 | }
11 | public void GetItemInfo(int pos, IItemDef itemDef)
12 | {
13 | switch (pos)
14 | {
15 | case 0:
16 | itemDef.ID = "AddMapBoxSatelliteLayerCommand";
17 | itemDef.Group = false;
18 | break;
19 | case 1:
20 | itemDef.ID = "AddMapBoxStreetsLayerCommand";
21 | itemDef.Group = false;
22 | break;
23 | case 2:
24 | itemDef.ID = "AddMapBoxTerrainLayerCommand";
25 | itemDef.Group = false;
26 | break;
27 |
28 | }
29 | }
30 |
31 | public int ItemCount
32 | {
33 | get { return 3; }
34 | }
35 |
36 | public string Name
37 | {
38 | get { return "BruTile"; }
39 | }
40 | }
41 | }
42 |
43 |
--------------------------------------------------------------------------------
/TrafficSpider/app/MenuDefs/CloudMadeMenuDef.cs:
--------------------------------------------------------------------------------
1 | using ESRI.ArcGIS.SystemUI;
2 |
3 | namespace BrutileArcGIS.MenuDefs
4 | {
5 | public class CloudMadeMenuDef : IMenuDef
6 | {
7 | public string Caption
8 | {
9 | get { return "&CloudMade"; }
10 | }
11 | public void GetItemInfo(int pos, IItemDef itemDef)
12 | {
13 | switch (pos)
14 | {
15 | case 0:
16 | itemDef.ID = "AddCloudMadeFreshLayerCommand";
17 | itemDef.Group = false;
18 | break;
19 | case 1:
20 | itemDef.ID = "AddCloudMadeMidnightCommanderLayerCommand";
21 | itemDef.Group = false;
22 | break;
23 | case 2:
24 | itemDef.ID = "AddCloudMadePaleDawnLayerCommand";
25 | itemDef.Group = false;
26 | break;
27 | }
28 | }
29 |
30 | public int ItemCount
31 | {
32 | get { return 3; }
33 | }
34 |
35 | public string Name
36 | {
37 | get { return "BruTile"; }
38 | }
39 | }
40 | }
--------------------------------------------------------------------------------
/TrafficSpider/BruTile/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // 有关程序集的常规信息通过以下
6 | // 特性集控制。更改这些特性值可修改
7 | // 与程序集关联的信息。
8 | [assembly: AssemblyTitle("BruTile")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("http://www.deepbbs.org")]
12 | [assembly: AssemblyProduct("BruTile")]
13 | [assembly: AssemblyCopyright("Copyright © http://www.deepbbs.org 2014")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // 将 ComVisible 设置为 false 使此程序集中的类型
18 | // 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型,
19 | // 则将该类型上的 ComVisible 特性设置为 true。
20 | [assembly: ComVisible(false)]
21 |
22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
23 | [assembly: Guid("ec854929-76cf-4901-9bf9-dcff6eb9ec05")]
24 |
25 | // 程序集的版本信息由下面四个值组成:
26 | //
27 | // 主版本
28 | // 次版本
29 | // 内部版本号
30 | // 修订号
31 | //
32 | // 可以指定所有这些值,也可以使用“内部版本号”和“修订号”的默认值,
33 | // 方法是按如下所示使用“*”:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/TrafficSpider/DownloadTiles/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.0
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace DownloadTiles.Properties {
12 |
13 |
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")]
16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
17 |
18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
19 |
20 | public static Settings Default {
21 | get {
22 | return defaultInstance;
23 | }
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/TrafficSpider/app/commands/AddPdokLayerCommand.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 | using BrutileArcGIS.Lib;
3 | using BrutileArcGIS.Properties;
4 |
5 | namespace BrutileArcGIS.commands
6 | {
7 | [ProgId("AddPdokBrtAchtergrondLayerCommand")]
8 | public sealed class AddPdokBrtAchtergrondLayerCommand : AddTmsLayerCommandBase
9 | {
10 | public AddPdokBrtAchtergrondLayerCommand()
11 | : base("Pdok", "&Brt achtergrond", "Add Brt Layer", "Pdok Brt", Resources.download, "http://acceptatie.geodata.nationaalgeoregister.nl/tiles/service/tms/1.0.0/brtachtergrondkaart@EPSG%3A25831%3ARWS@png8", EnumBruTileLayer.TMS)
12 | {
13 | }
14 | }
15 |
16 |
17 | [ProgId("AddPdokBrpGewaspercelenLayerCommand")]
18 | public sealed class AddPdokBrpGewaspercelenLayerCommand : AddTmsLayerCommandBase
19 | {
20 | public AddPdokBrpGewaspercelenLayerCommand()
21 | : base("Pdok", "&Brp gewaspercelen", "Add Brp gewaspercelen", "Pdok Brp", Resources.download, "http://acceptatie.geodata.nationaalgeoregister.nl/tiles/service/tms/1.0.0/brpgewaspercelen@EPSG%3A28992@png8", EnumBruTileLayer.TMS)
22 | {
23 | }
24 | }
25 | }
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/TrafficSpider/app/ArcBruTileInstaller.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace BruTileArcGIS
2 | {
3 | partial class ArcBruTileInstaller
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Component Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | components = new System.ComponentModel.Container();
32 | }
33 |
34 | #endregion
35 | }
36 | }
--------------------------------------------------------------------------------
/TrafficSpider/app/lib/ConfigInvertedTMS.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Net;
3 | using BruTile;
4 | using BruTile.Predefined;
5 | using BruTile.Tms;
6 |
7 | namespace BrutileArcGIS.Lib
8 | {
9 | public class ConfigInvertedTMS : IConfig
10 | {
11 | private string _url;
12 |
13 | public ConfigInvertedTMS(string url)
14 | {
15 | if (url == null) throw new ArgumentNullException("url");
16 | _url = url;
17 | }
18 |
19 | public ITileSource CreateTileSource()
20 | {
21 | var request = (HttpWebRequest)WebRequest.Create(_url);
22 | request.UserAgent = "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14";
23 | var response = (HttpWebResponse)request.GetResponse();
24 | var stream = response.GetResponseStream();
25 | var tileSource = TileMapParser.CreateTileSource(stream);
26 | return new TileSource(tileSource.Provider, new SphericalMercatorInvertedWorldSchema());
27 | }
28 |
29 | public string Url
30 | {
31 | get { return _url; }
32 | set { _url = value; }
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/TrafficSpider/BruTile/Tms/TmsTileSource.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) BruTile developers team. All rights reserved. See License.txt in the project root for license information.
2 |
3 | using BruTile.Cache;
4 | using BruTile.Web;
5 | using System;
6 | using System.IO;
7 |
8 | namespace BruTile.Tms
9 | {
10 | public class TmsTileSource : TileSource
11 | {
12 | [Obsolete("Use HttpTileSource")]
13 | public TmsTileSource(string serviceUrl, ITileSchema tileSchema)
14 | : this (new Uri(serviceUrl), tileSchema)
15 | {
16 | }
17 |
18 | [Obsolete("Use HttpTileSource")]
19 | public TmsTileSource(Uri serviceUri, ITileSchema tileSchema, IPersistentCache persistentCache = null,
20 | Func fetchTile = null) :
21 | base(new WebTileProvider(new TmsRequest(serviceUri, tileSchema.Format), persistentCache,
22 | fetchTile), tileSchema)
23 | {
24 | }
25 |
26 | public static ITileSource CreateFromTileMapResource(Stream tileMapResource)
27 | {
28 | // This method should be moved somewhere else
29 | return TileMapParser.CreateTileSource(tileMapResource);
30 | }
31 | }
32 | }
--------------------------------------------------------------------------------
/TrafficSpider/BruTile.Desktop/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // 有关程序集的常规信息通过以下
6 | // 特性集控制。更改这些特性值可修改
7 | // 与程序集关联的信息。
8 | [assembly: AssemblyTitle("BruTile.Desktop")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("http://www.deepbbs.org")]
12 | [assembly: AssemblyProduct("BruTile.Desktop")]
13 | [assembly: AssemblyCopyright("Copyright © http://www.deepbbs.org 2014")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // 将 ComVisible 设置为 false 使此程序集中的类型
18 | // 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型,
19 | // 则将该类型上的 ComVisible 特性设置为 true。
20 | [assembly: ComVisible(false)]
21 |
22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
23 | [assembly: Guid("0ea80694-111f-454a-9f77-f9f77c7349a6")]
24 |
25 | // 程序集的版本信息由下面四个值组成:
26 | //
27 | // 主版本
28 | // 次版本
29 | // 内部版本号
30 | // 修订号
31 | //
32 | // 可以指定所有这些值,也可以使用“内部版本号”和“修订号”的默认值,
33 | // 方法是按如下所示使用“*”:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/TrafficSpider/GetTiles/Web.Release.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
17 |
18 |
19 |
30 |
31 |
--------------------------------------------------------------------------------
/TrafficSpider/BruTile/Cache/ITileCache.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) BruTile developers team. All rights reserved. See License.txt in the project root for license information.
2 |
3 | namespace BruTile.Cache
4 | {
5 | public interface ITileCache
6 | {
7 | ///
8 | /// Adds a tile that corresponds to the index
9 | ///
10 | /// The index of the tile to add. If the tile already exists no exepection is thrown.
11 | /// The tile data
12 | void Add(TileIndex index, T tile);
13 | ///
14 | /// Removes the tile that corresponds with the index passed as argument. When the tile is not found no exception is thrown.
15 | ///
16 | /// The index of the tile to be removed.
17 | void Remove(TileIndex index);
18 | ///
19 | /// Tries to find a tile that corresponds with the index. Returns null if not found.
20 | ///
21 | /// The index of the tile to find
22 | /// The tile data that corresponds with the index or null.
23 | T Find(TileIndex index);
24 | }
25 | }
--------------------------------------------------------------------------------
/TrafficSpider/BruTile/Wms/Schema/1.1.0/exception_1_1_0.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 | Plain text message about an error.
7 |
8 |
9 | Another message, this time with a SE code supplied.
10 |
11 |
12 | , line 42
14 |
15 | A message that includes angle brackets in text
16 | must be enclosed in a Character Data Section
17 | as in this example. All XML-like markup is
18 | ignored except for this sequence of three
19 | closing characters:
20 | ]]>
21 |
22 |
23 | foo.c
25 | An error occurred
26 | Similarly, actual XML
27 | can be enclosed in a CDATA section.
28 | A generic parser will ignore that XML,
29 | but application-specific software may choose
30 | to process it.
31 | ]]>
32 |
33 |
34 |
--------------------------------------------------------------------------------
/TrafficSpider/BruTile/Wms/Schema/1.1.1/exception_1_1_1.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 | Plain text message about an error.
7 |
8 |
9 | Another message, this one with a Service Exception code supplied.
10 |
11 |
12 | , line 42
14 |
15 | A message that includes angle brackets in text
16 | must be enclosed in a Character Data Section
17 | as in this example. All XML-like markup is
18 | ignored except for this sequence of three
19 | closing characters:
20 | ]]>
21 |
22 |
23 | foo.c
25 | An error occurred
26 | Similarly, actual XML
27 | can be enclosed in a CDATA section.
28 | A generic parser will ignore that XML,
29 | but application-specific software may choose
30 | to process it.
31 | ]]>
32 |
33 |
34 |
--------------------------------------------------------------------------------
/TrafficSpider/app/commands/AddBingLayerCommand.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 | using BrutileArcGIS.Lib;
3 | using BrutileArcGIS.Properties;
4 |
5 | namespace BrutileArcGIS.commands
6 | {
7 | [ProgId("AddBingAerialLayerCommand")]
8 | public sealed class AddBingAerialLayerCommand : AddBruTileLayerCommandBase
9 | {
10 | public AddBingAerialLayerCommand()
11 | : base("BruTile", "&Aerial", "Add Bing Aerial Layer", "Bing Aerial", Resources.bing, EnumBruTileLayer.BingAerial)
12 | {
13 | }
14 | }
15 |
16 | [ProgId("AddBingHybridLayerCommand")]
17 | public sealed class AddBingHybridLayerCommand : AddBruTileLayerCommandBase
18 | {
19 | public AddBingHybridLayerCommand()
20 | : base("BruTile", "&Hybrid", "Add Bing Hybrid Layer", "Bing Hybrid", Resources.bing, EnumBruTileLayer.BingHybrid)
21 | {
22 | }
23 | }
24 |
25 | [ProgId("AddBingRoadLayerCommand")]
26 | public sealed class AddBingRoadLayerCommand : AddBruTileLayerCommandBase
27 | {
28 | public AddBingRoadLayerCommand()
29 | : base("BruTile", "&Roads", "Add Bing Road Layer", "Bing Road", Resources.bing, EnumBruTileLayer.BingRoad)
30 | {
31 | }
32 | }
33 |
34 |
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/TrafficSpider/BruTile/Wms/Schema/1.3.0/exceptions_1_3_0.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 | Plain text message about an error.
8 |
9 |
10 | Another error message, this one with a service exception code supplied.
11 |
12 |
13 | , line 42
15 |
16 | A message that includes angle brackets in text
17 | must be enclosed in a Character Data Section
18 | as in this example. All XML-like markup is
19 | ignored except for this sequence of three
20 | closing characters:
21 | ]]>
22 |
23 |
24 | foo.c
26 | An error occurred
27 | Similarly, actual XML
28 | can be enclosed in a CDATA section.
29 | A generic parser will ignore that XML,
30 | but application-specific software may choose
31 | to process it.
32 | ]]>
33 |
34 |
35 |
--------------------------------------------------------------------------------
/TrafficSpider/BruTile/Web/WebTileProvider.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) BruTile developers team. All rights reserved. See License.txt in the project root for license information.
2 |
3 | using BruTile.Cache;
4 | using System;
5 |
6 | namespace BruTile.Web
7 | {
8 | public class WebTileProvider : ITileProvider
9 | {
10 | private readonly IPersistentCache _persistentCache;
11 | public IRequest Request { get; set; }
12 | private readonly Func _fetchTile;
13 |
14 | public WebTileProvider(IRequest request = null, IPersistentCache persistentCache = null,
15 | Func fetchTile = null)
16 | {
17 | Request = request ?? new NullRequest();
18 | _persistentCache = persistentCache ?? new NullCache();
19 | _fetchTile = fetchTile ?? (RequestHelper.FetchImage);
20 | }
21 |
22 | public byte[] GetTile(TileInfo tileInfo)
23 | {
24 | var bytes = _persistentCache.Find(tileInfo.Index);
25 | if (bytes == null)
26 | {
27 | bytes = _fetchTile(Request.GetUri(tileInfo));
28 | if (bytes != null) _persistentCache.Add(tileInfo.Index, bytes);
29 | }
30 | return bytes;
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/TrafficSpider/BruTile/Wmts/xsd/wmts.xsd:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 | wmts
9 |
10 | This XML Schema Document includes all WMTS schemas and
11 | is useful for SOAP messages.
12 |
13 | WMTS is an OGC Standard.
14 | Copyright (c) 2009,2010 Open Geospatial Consortium.
15 | To obtain additional rights of use, visit http://www.opengeospatial.org/legal/.
16 |
17 |
18 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/TrafficSpider/app/lib/ConfigurationHelper.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Configuration;
3 | using System.Reflection;
4 |
5 | namespace BrutileArcGIS.Lib
6 | {
7 | public class ConfigurationHelper
8 | {
9 | public static int GetTileTimeOut()
10 | {
11 | var config = GetConfig();
12 | var tileTimeOut = Int32.Parse(config.AppSettings.Settings["tileTimeout"].Value);
13 | return tileTimeOut;
14 | }
15 |
16 | public static Configuration GetConfig()
17 | {
18 | Configuration config;
19 |
20 | var configFileName = Assembly.GetExecutingAssembly().Location + ".config";
21 | var fileMap = new ExeConfigurationFileMap();
22 | try
23 | {
24 | // You may want to map to your own exe.config file here.
25 | fileMap.ExeConfigFilename = configFileName;
26 | config = ConfigurationManager.OpenMappedExeConfiguration(fileMap, ConfigurationUserLevel.None);
27 | }
28 | catch
29 | {
30 | var msg = String.Format("Can not find ({0})", configFileName);
31 | throw new ApplicationException(msg);
32 | }
33 |
34 | return config;
35 | }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/TrafficSpider/BruTile/Wmts/ScaleSetItem.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) BruTile developers team. All rights reserved. See License.txt in the project root for license information.
2 |
3 | namespace BruTile.Wmts
4 | {
5 | ///
6 | /// A precomputed pair of ScaleDenominator and PixelSize
7 | ///
8 | internal struct ScaleSetItem
9 | {
10 | private readonly double _scaleDenominator;
11 | private readonly double _pixelSize;
12 |
13 | ///
14 | /// Initializes a scale set item with the provided values
15 | ///
16 | /// The scale denominator
17 | /// The pixel size
18 | public ScaleSetItem(double scaleDenominator, double pixelSize)
19 | {
20 | _scaleDenominator = scaleDenominator;
21 | _pixelSize = pixelSize;
22 | }
23 |
24 | ///
25 | /// Gets a value indicating the scale denominator (1:...)
26 | ///
27 | public double ScaleDenominator { get { return _scaleDenominator; } }
28 |
29 | ///
30 | /// Gets a value indicating the pixel size
31 | ///
32 | public double PixelSize { get { return _pixelSize; } }
33 | }
34 | }
--------------------------------------------------------------------------------
/TrafficSpider/app/commands/AboutPdokCommand.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 | using BrutileArcGIS.forms;
3 | using BrutileArcGIS.Lib;
4 | using ESRI.ArcGIS.ADF.BaseClasses;
5 | using ESRI.ArcGIS.ArcMapUI;
6 | using ESRI.ArcGIS.Framework;
7 |
8 | namespace BrutileArcGIS.commands
9 | {
10 | [ProgId("AboutPdokCommand")]
11 | public sealed class AboutPdokCommand : BaseCommand
12 | {
13 | private IApplication _application;
14 |
15 | public AboutPdokCommand()
16 | {
17 | m_category = "BruTile";
18 | m_caption = "&About Pdok...";
19 | m_message = "About Pdok...";
20 | m_toolTip = m_caption;
21 | m_name = "AboutPdokCommand";
22 | }
23 |
24 | public override void OnCreate(object hook)
25 | {
26 | if (hook == null)
27 | return;
28 |
29 | _application = hook as IApplication;
30 |
31 | //Disable if it is not ArcMap
32 | if (hook is IMxApplication)
33 | m_enabled = true;
34 | else
35 | m_enabled = false;
36 | }
37 |
38 | public override void OnClick()
39 | {
40 | var bruTileAboutBox = new BruTileAboutBox();
41 | bruTileAboutBox.ShowDialog(new ArcMapWindow(_application));
42 | }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/TrafficSpider/BruTile/Wms/Schema/1.3.0/exceptions_1_3_0.xsd:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
14 |
15 |
16 |
17 |
18 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/TrafficSpider/BruTile/TileSource.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) BruTile developers team. All rights reserved. See License.txt in the project root for license information.
2 |
3 | namespace BruTile
4 | {
5 | ///
6 | /// The default implementation of a .
7 | ///
8 | public class TileSource : ITileSource
9 | {
10 | ///
11 | /// Creates an instance of this class
12 | ///
13 | /// The tile provider
14 | /// The tile schema
15 | public TileSource(ITileProvider tileProvider, ITileSchema tileSchema)
16 | {
17 | Provider = tileProvider;
18 | Schema = tileSchema;
19 | }
20 |
21 | ///
22 | /// Gets a value indicating the title of the tile source
23 | ///
24 | public string Name { get; set; }
25 |
26 | ///
27 | /// Gets a value indicating the tile provider
28 | ///
29 | public ITileProvider Provider { get; private set; }
30 |
31 | ///
32 | /// Gets a value indicating the tile schema
33 | ///
34 | public ITileSchema Schema { get; private set; }
35 |
36 | public override string ToString()
37 | {
38 | return string.Format("[TileSource:{0}]", Name);
39 | }
40 | }
41 | }
--------------------------------------------------------------------------------
/TrafficSpider/BruTile/Web/HttpTileSource.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) BruTile developers team. All rights reserved. See License.txt in the project root for license information.
2 |
3 | using BruTile.Cache;
4 | using System;
5 | using System.Collections.Generic;
6 |
7 | namespace BruTile.Web
8 | {
9 | public class HttpTileSource : ITileSource
10 | {
11 | private readonly ITileSchema _tileSchema;
12 | private readonly WebTileProvider _webTileProvider;
13 |
14 | public HttpTileSource(ITileSchema tileSchema, string urlFormatter, IEnumerable serverNodes = null, string apiKey = null, string name = null, IPersistentCache persistentCache = null, Func tileFetcher = null)
15 | : this(tileSchema, new BasicRequest(urlFormatter, serverNodes, apiKey), name, persistentCache, tileFetcher)
16 | {
17 | }
18 |
19 | public HttpTileSource(ITileSchema tileSchema, IRequest request, string name = null, IPersistentCache persistentCache = null, Func tileFetcher = null)
20 | {
21 | _webTileProvider = new WebTileProvider(request, persistentCache, tileFetcher);
22 | _tileSchema = tileSchema;
23 | Name = name ?? string.Empty;
24 | }
25 |
26 | public ITileProvider Provider { get { return _webTileProvider; } }
27 | public ITileSchema Schema { get { return _tileSchema; } }
28 | public string Name { get; set; }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/TrafficSpider/BruTile/Tms/TileMapService.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) BruTile developers team. All rights reserved. See License.txt in the project root for license information.
2 |
3 | using System.Collections.Generic;
4 | using System.IO;
5 | using System.Linq;
6 | using System.Xml.Linq;
7 |
8 | namespace BruTile.Tms
9 | {
10 | public class TileMapService
11 | {
12 | public IEnumerable TileMaps { get; set; }
13 | public string Version { get; set; }
14 |
15 | public static TileMapService CreateFromResource(Stream result)
16 | {
17 | var tileMapService = new TileMapService();
18 |
19 | XDocument xml = XDocument.Parse(new StreamReader(result).ReadToEnd());
20 |
21 | tileMapService.TileMaps =
22 | from tileMap in xml.Root.Descendants("TileMap")
23 | select new TileMapItem
24 | {
25 | Href = tileMap.Attribute("href").Value,
26 | Srs = tileMap.Attribute("srs").Value,
27 | Title = tileMap.Attribute("title").Value,
28 | Profile = tileMap.Attribute("profile").Value
29 | };
30 |
31 | return tileMapService;
32 | }
33 | }
34 |
35 | public class TileMapItem
36 | {
37 | public string Href { get; set; }
38 | public string Srs { get; set; }
39 | public string Title { get; set; }
40 | public string Profile { get; set; }
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/TrafficSpider/app/lib/MultipleThreadResetEvent.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Threading;
3 |
4 | namespace BrutileArcGIS.Lib
5 | {
6 | public class MultipleThreadResetEvent : IDisposable
7 | {
8 | private readonly ManualResetEvent _done;
9 | private readonly int _total;
10 | private long _current;
11 |
12 | ///
13 | /// 构造函数
14 | ///
15 | /// 需要等待执行的线程总数
16 | public MultipleThreadResetEvent(int total)
17 | {
18 | this._total = total;
19 | _current = total;
20 | _done = new ManualResetEvent(false);
21 |
22 | }
23 | ///
24 | /// 唤醒一个等待的线程
25 | ///
26 | public void SetOne()
27 | {
28 | // Interlocked 原子操作类 ,此处将计数器减1
29 | if (Interlocked.Decrement(ref _current) == 0)
30 | {
31 | //当所以等待线程执行完毕时,唤醒等待的线程
32 | _done.Set();
33 | }
34 | }
35 |
36 | ///
37 | /// 等待所以线程执行完毕
38 | ///
39 | public void WaitAll()
40 | {
41 | _done.WaitOne();
42 | }
43 |
44 | ///
45 | /// 释放对象占用的空间
46 | ///
47 | public void Dispose()
48 | {
49 | ((IDisposable)_done).Dispose();
50 | }
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/TrafficSpider/app/commands/AddStamenLayerCommand.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 | using BrutileArcGIS.Lib;
3 | using BrutileArcGIS.Properties;
4 |
5 | namespace BrutileArcGIS.commands
6 | {
7 | [ProgId("AddStamenWaterColorLayerCommand")]
8 | public sealed class AddStamenWaterColorLayerCommand : AddTmsLayerCommandBase
9 | {
10 | public AddStamenWaterColorLayerCommand()
11 | : base("BruTile", "&Watercolor", "Add Watercolor Layer", "Stamen WaterColor", Resources.download, "http://dl.dropbox.com/u/9984329/ArcBruTile/Services/Stamen/watercolor.xml",EnumBruTileLayer.InvertedTMS)
12 | {
13 | }
14 | }
15 |
16 | [ProgId("AddStamenTonerLayerCommand")]
17 | public sealed class AddStamenTonerLayerCommand : AddTmsLayerCommandBase
18 | {
19 | public AddStamenTonerLayerCommand()
20 | : base("BruTile", "&Toner", "Add Toner Layer", "Stamen Toner", Resources.download, "http://dl.dropbox.com/u/9984329/ArcBruTile/Services/Stamen/toner.xml", EnumBruTileLayer.InvertedTMS)
21 | {
22 | }
23 | }
24 |
25 | [ProgId("AddStamenTerrainLayerCommand")]
26 | public sealed class AddStamenTerrainLayerCommand : AddTmsLayerCommandBase
27 | {
28 | public AddStamenTerrainLayerCommand()
29 | : base("BruTile", "&Terrain", "Add Terrain Layer", "Stamen Terrain", Resources.download, "http://dl.dropbox.com/u/9984329/ArcBruTile/Services/Stamen/terrain.xml", EnumBruTileLayer.InvertedTMS)
30 | {
31 | }
32 | }
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/TrafficSpider/app/commands/AddMapBoxLayerCommand.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 | using BrutileArcGIS.Lib;
3 | using BrutileArcGIS.Properties;
4 |
5 | namespace BrutileArcGIS.commands
6 | {
7 | [ProgId("AddMapBoxSatelliteLayerCommand")]
8 | public sealed class AddMapBoxSatelliteLayerCommand : AddTmsLayerCommandBase
9 | {
10 | public AddMapBoxSatelliteLayerCommand()
11 | : base("BruTile", "&Satellite", "Add Satellite Layer", "MapBox Satellite", Resources.download, "http://dl.dropbox.com/u/9984329/ArcBruTile/Services/MapBox/Satellite.xml", EnumBruTileLayer.InvertedTMS)
12 | {
13 | }
14 | }
15 |
16 | [ProgId("AddMapBoxStreetsLayerCommand")]
17 | public sealed class AddMapBoxStreetsLayerCommand : AddTmsLayerCommandBase
18 | {
19 | public AddMapBoxStreetsLayerCommand()
20 | : base("BruTile", "&Streets", "Add Streets Layer", "MapBox Streets", Resources.download, "http://dl.dropbox.com/u/9984329/ArcBruTile/Services/MapBox/Streets.xml", EnumBruTileLayer.InvertedTMS)
21 | {
22 | }
23 | }
24 |
25 | [ProgId("AddMapBoxTerrainLayerCommand")]
26 | public sealed class AddMapBoxTerrainLayerCommand : AddTmsLayerCommandBase
27 | {
28 | public AddMapBoxTerrainLayerCommand()
29 | : base("BruTile", "&Terrain", "Add Terrain Layer", "MapBox Terrain", Resources.download, "http://dl.dropbox.com/u/9984329/ArcBruTile/Services/MapBox/terrain.xml", EnumBruTileLayer.InvertedTMS)
30 | {
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/TrafficSpider/app/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("ArcBruTile")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("ArcBruTile")]
13 | [assembly: AssemblyCopyright("")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(true)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("9775f479-36fb-47ad-a320-be374b50ad7b")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("0.4")]
36 | [assembly: AssemblyFileVersion("0.4")]
37 |
--------------------------------------------------------------------------------
/TrafficSpider/BruTile/Wms/Schema/1.1.1/WMS_DescribeLayerResponse.dtd:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
6 |
7 |
10 |
11 |
12 |
17 |
18 |
19 |
20 |
21 |
23 |
--------------------------------------------------------------------------------
/TrafficSpider/app/lib/TmsTileMapServiceParser.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Xml;
3 | using BrutileArcGIS.lib;
4 |
5 | namespace BrutileArcGIS.Lib
6 | {
7 | public class TmsTileMapServiceParser
8 | {
9 | public static List GetTileMaps(string url)
10 | {
11 | var doc = Requester.GetXmlDocument(url);
12 | var nodes=doc.GetElementsByTagName("TileMap");
13 |
14 | var tilemaps=new List();
15 | foreach (XmlNode node in nodes)
16 | {
17 | var tileMap=new TileMap();
18 | if (node.Attributes != null)
19 | {
20 | tileMap.Href = node.Attributes["href"].Value;
21 | tileMap.Srs = node.Attributes["srs"].Value;
22 | tileMap.Profile = node.Attributes["profile"].Value;
23 | tileMap.Title= node.Attributes["title"].Value;
24 | tileMap.Title = node.Attributes["title"].Value;
25 | if (node.Attributes["type"] != null)
26 | {
27 | tileMap.Type = node.Attributes["type"].Value;
28 | }
29 | if (node.Attributes["overwriteurls"] != null)
30 | {
31 | tileMap.OverwriteUrls = bool.Parse(node.Attributes["overwriteurls"].Value);
32 | }
33 | }
34 |
35 |
36 | tilemaps.Add(tileMap);
37 | }
38 |
39 | return tilemaps;
40 | }
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/TrafficSpider/app/commands/AddCloudMadeLayerCommand.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 | using BrutileArcGIS.Lib;
3 | using BrutileArcGIS.Properties;
4 |
5 | namespace BrutileArcGIS.commands
6 | {
7 | [ProgId("AddCloudMadeFreshLayerCommand")]
8 | public sealed class AddCloudMadeFreshLayerCommand : AddTmsLayerCommandBase
9 | {
10 | public AddCloudMadeFreshLayerCommand()
11 | : base("BruTile", "&Fresh", "Add Fresh Layer", "CloudMade Fresh", Resources.download, "http://dl.dropbox.com/u/9984329/ArcBruTile/Services/CloudMade/Fresh.xml", EnumBruTileLayer.InvertedTMS)
12 | {
13 | }
14 | }
15 |
16 | [ProgId("AddCloudMadeMidnightCommanderLayerCommand")]
17 | public sealed class AddCloudMadeMidnightCommanderLayerCommand : AddTmsLayerCommandBase
18 | {
19 | public AddCloudMadeMidnightCommanderLayerCommand()
20 | : base("BruTile", "&Midnight Commander", "Add Midnight Commander Layer", "CloudMade Midnight Commander", Resources.download, "http://dl.dropbox.com/u/9984329/ArcBruTile/Services/CloudMade/Midnight Commander.xml", EnumBruTileLayer.InvertedTMS)
21 | {
22 | }
23 | }
24 |
25 | [ProgId("AddCloudMadePaleDawnLayerCommand")]
26 | public sealed class AddCloudMadePaleDawnLayerCommand : AddTmsLayerCommandBase
27 | {
28 | public AddCloudMadePaleDawnLayerCommand()
29 | : base("BruTile", "&Pale Dawn", "Add Pale Dawn Layer", "CloudMade Pale Dawn", Resources.download, "http://dl.dropbox.com/u/9984329/ArcBruTile/Services/CloudMade/Pale Dawn.xml", EnumBruTileLayer.InvertedTMS)
30 | {
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/TrafficSpider/BruTile/Wms/DCPType.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) BruTile developers team. All rights reserved. See License.txt in the project root for license information.
2 |
3 | using System.Xml;
4 | using System.Xml.Linq;
5 |
6 | namespace BruTile.Wms
7 | {
8 | // ReSharper disable InconsistentNaming
9 | public class DCPType : XmlObject
10 | {
11 | public DCPType()
12 | {
13 | Http = new Http();
14 | }
15 |
16 | public DCPType(XElement node, string @namespace)
17 | {
18 | var element = node.Element(XName.Get("HTTP", @namespace));
19 | if (element != null)
20 | Http = new Http(element, @namespace);
21 | }
22 |
23 | public Http Http { get; set; }
24 |
25 | #region Overrides of XmlObject
26 |
27 | public override void ReadXml(XmlReader reader)
28 | {
29 | if (CheckEmptyNode(reader, "DCPType", Namespace))
30 | return;
31 | reader.MoveToContent();
32 | Http.ReadXml(reader.ReadSubtree());
33 | }
34 |
35 | public override void WriteXml(XmlWriter writer)
36 | {
37 | writer.WriteStartElement("HTTP", Namespace);
38 | Http.WriteXml(writer);
39 | writer.WriteEndElement();
40 | }
41 |
42 | public override XElement ToXElement(string @namespace)
43 | {
44 | return new XElement(XName.Get("DCPType", @namespace),
45 | Http.ToXElement(@namespace));
46 | }
47 |
48 | #endregion Overrides of XmlObject
49 | }
50 |
51 | // ReSharper restore InconsistentNaming
52 | }
--------------------------------------------------------------------------------
/TrafficSpider/BruTile/Wms/ServiceExceptionReport.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) BruTile developers team. All rights reserved. See License.txt in the project root for license information.
2 |
3 | using System.Collections.Generic;
4 | using System.Xml;
5 | using System.Xml.Linq;
6 |
7 | namespace BruTile.Wms
8 | {
9 | public class ServiceExceptionReport : XmlObject
10 | {
11 | public List ServiceExceptions { get; private set; }
12 |
13 | public string Version { get; set; }
14 |
15 | public ServiceExceptionReport()
16 | {
17 | ServiceExceptions = new List();
18 | Version = "1.3.0";
19 | }
20 |
21 | public ServiceExceptionReport(XElement node, string ns) : this()
22 | {
23 | var att = node.Attribute(XName.Get("version"));
24 | if (att != null)
25 | Version = att.Value;
26 |
27 | foreach (var serviceException in node.Elements(XName.Get("ServiceException", ns)))
28 | ServiceExceptions.Add(new ServiceException(serviceException, ns));
29 | }
30 |
31 | #region Overrides of XmlObject
32 |
33 | public override void ReadXml(XmlReader reader)
34 | {
35 | throw new System.NotImplementedException();
36 | }
37 |
38 | public override void WriteXml(XmlWriter writer)
39 | {
40 | throw new System.NotImplementedException();
41 | }
42 |
43 | public override XElement ToXElement(string @namespace)
44 | {
45 | throw new System.NotImplementedException();
46 | }
47 |
48 | #endregion Overrides of XmlObject
49 | }
50 | }
--------------------------------------------------------------------------------
/TrafficSpider/BruTile/Wmts/xsd/wmtsGetCapabilities_request.xsd:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 | wmtsGetCapabilities_request
10 |
11 | This XML Schema Document defines the XML WMTS
12 | GetCapabilites request that can be used in SOAP encodings.
13 |
14 | WMTS is an OGC Standard.
15 | Copyright (c) 2009,2010 Open Geospatial Consortium.
16 | To obtain additional rights of use, visit http://www.opengeospatial.org/legal/.
17 |
18 |
19 |
22 |
23 |
24 |
27 |
28 |
29 | WMTS GetCapabilities operation request.
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/TrafficSpider/BruTile/PreDefined/WkstNederlandSchema.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) BruTile developers team. All rights reserved. See License.txt in the project root for license information.
2 |
3 | using System;
4 | using System.Globalization;
5 | using System.Linq;
6 |
7 | namespace BruTile.Predefined
8 | {
9 | public class WkstNederlandSchema : TileSchema
10 | {
11 | // Well known scale set: urn:ogc:def:wkss:OGC:1.0:NLDEPSG28992Scale
12 | // see: http://www.geonovum.nl/sites/default/files/Nederlandse_richtlijn_tiling_-_versie_1.0.pdf
13 |
14 | public WkstNederlandSchema()
15 | {
16 | var resolutions = new[] {
17 | 3440.64,
18 | 1720.32,
19 | 860.16,
20 | 430.08,
21 | 215.04,
22 | 107.52,
23 | 53.76,
24 | 26.88,
25 | 13.44,
26 | 6.72,
27 | 3.36,
28 | 1.68,
29 | 0.84,
30 | 0.42,
31 | 0.21
32 | };
33 |
34 | var count = 0;
35 | foreach (var resolution in resolutions)
36 | {
37 | var levelId = count.ToString(CultureInfo.InvariantCulture);
38 | Resolutions[levelId] = new Resolution {Id = levelId, UnitsPerPixel = resolution};
39 | count++;
40 | }
41 | Height = 256;
42 | Width = 256;
43 | Extent = new Extent(-285401.920, 22598.080, 595401.92, 903401.920);
44 | OriginX = -285401.920;
45 | OriginY = 22598.080;
46 | Name = "urn:ogc:def:wkss:OGC:1.0:NLDEPSG28992Scale";
47 | Format = "png";
48 | YAxis = YAxis.TMS;
49 | Srs = "EPSG:28992";
50 | }
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/TrafficSpider/BruTile/TileRange.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) BruTile developers team. All rights reserved. See License.txt in the project root for license information.
2 |
3 | namespace BruTile
4 | {
5 | public struct TileRange
6 | {
7 | public int FirstCol { get; private set; }
8 | public int FirstRow { get; private set; }
9 | public int ColCount { get; private set; }
10 | public int RowCount { get; private set; }
11 |
12 | public TileRange(int col, int row) : this(col, row, 1, 1) { }
13 |
14 | public TileRange(int firstCol, int firstRow, int colCount, int rowCount) : this()
15 | {
16 | FirstCol = firstCol;
17 | FirstRow = firstRow;
18 | ColCount = colCount;
19 | RowCount = rowCount;
20 | }
21 |
22 | public override bool Equals(object obj)
23 | {
24 | if (!(obj is TileRange))
25 | return false;
26 |
27 | return Equals((TileRange)obj);
28 | }
29 |
30 | public bool Equals(TileRange tileRange)
31 | {
32 | return
33 | FirstCol == tileRange.FirstCol &&
34 | ColCount == tileRange.ColCount &&
35 | FirstRow == tileRange.FirstRow &&
36 | RowCount == tileRange.RowCount;
37 | }
38 |
39 | public override int GetHashCode()
40 | {
41 | return FirstCol ^ ColCount ^ FirstRow ^ RowCount;
42 | }
43 |
44 | public static bool operator ==(TileRange tileRange1, TileRange tileRange2)
45 | {
46 | return Equals(tileRange1, tileRange2);
47 | }
48 |
49 | public static bool operator !=(TileRange tileRange1, TileRange tileRange2)
50 | {
51 | return !Equals(tileRange1, tileRange2);
52 | }
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/TrafficSpider/app/lib/ConfigHelper.cs:
--------------------------------------------------------------------------------
1 | using BruTile.Web;
2 |
3 | namespace BrutileArcGIS.Lib
4 | {
5 | public class ConfigHelper
6 | {
7 | public static IConfig GetTmsConfig(string url, bool overwriteUrls)
8 | {
9 | return new ConfigTms(url, overwriteUrls);
10 | }
11 |
12 | public static IConfig GetConfig(EnumBruTileLayer enumBruTileLayer, string url, bool overwriteUrls)
13 | {
14 | IConfig result;
15 |
16 | if (enumBruTileLayer == EnumBruTileLayer.TMS)
17 | {
18 | result = new ConfigTms(url, overwriteUrls);
19 | }
20 | else if (enumBruTileLayer == EnumBruTileLayer.InvertedTMS)
21 | {
22 | result = new ConfigInvertedTMS(url);
23 | }
24 | else
25 | {
26 | result = new ConfigOsm(OsmMapType.Default);
27 | }
28 |
29 | return result;
30 | }
31 |
32 | public static IConfig GetConfig(EnumBruTileLayer enumBruTileLayer)
33 | {
34 | IConfig result = new ConfigOsm(OsmMapType.Default);
35 |
36 | if (enumBruTileLayer == EnumBruTileLayer.OSM)
37 | {
38 | result = new ConfigOsm(OsmMapType.Default);
39 | }
40 | else if (enumBruTileLayer == EnumBruTileLayer.BingRoad)
41 | {
42 | result = new ConfigBing(BingMapType.Roads);
43 | }
44 | else if (enumBruTileLayer == EnumBruTileLayer.BingHybrid)
45 | {
46 | result = new ConfigBing(BingMapType.Hybrid);
47 | }
48 | else if (enumBruTileLayer == EnumBruTileLayer.BingAerial)
49 | {
50 | result = new ConfigBing(BingMapType.Aerial);
51 | }
52 | return result;
53 | }
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/TrafficSpider/app/lib/WorldFileWriter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Globalization;
3 | using System.IO;
4 | using BruTile;
5 |
6 | namespace BrutileArcGIS.lib
7 | {
8 | public class WorldFileWriter
9 | {
10 | public static string GetWorldFile(string format)
11 | {
12 | var res = String.Empty;
13 |
14 | format = (format.Contains(@"image/") ? format.Substring(6, format.Length - 6) : format);
15 |
16 | if (format == "jpg")
17 | {
18 | res = "jgw";
19 | }
20 | if (format == "jpeg")
21 | {
22 | res = "jgw";
23 | }
24 | else if (format == "png")
25 | {
26 | res = "pgw";
27 | }
28 | else if (format == "png8")
29 | {
30 | res = "pgw";
31 | }
32 |
33 | else if (format == "tif")
34 | {
35 | res = "tfw";
36 | }
37 |
38 | return res;
39 |
40 | }
41 |
42 |
43 | public static void WriteWorldFile(string f, Extent extent, ITileSchema schema)
44 | {
45 | using (var sw = new StreamWriter(f))
46 | {
47 | var resX = (extent.MaxX - extent.MinX) / schema.GetTileWidth("0");
48 | var resY = (extent.MaxY - extent.MinY) / schema.GetTileHeight("0");
49 | sw.WriteLine(resX.ToString(CultureInfo.InvariantCulture));
50 | sw.WriteLine("0");
51 | sw.WriteLine("0");
52 | sw.WriteLine((resY * -1).ToString(CultureInfo.InvariantCulture));
53 | sw.WriteLine(extent.MinX.ToString(CultureInfo.InvariantCulture));
54 | sw.WriteLine(extent.MaxY.ToString(CultureInfo.InvariantCulture));
55 | sw.Close();
56 | }
57 | }
58 |
59 |
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/TrafficSpider/app/commands/AboutBruTileCommand.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 | using BruTile.Cache;
3 | using BruTile.Web;
4 | using BrutileArcGIS.forms;
5 | using BrutileArcGIS.lib;
6 | using BrutileArcGIS.Lib;
7 | using ESRI.ArcGIS.ADF.BaseClasses;
8 | using ESRI.ArcGIS.ArcMapUI;
9 | using ESRI.ArcGIS.Framework;
10 |
11 | namespace BrutileArcGIS.commands
12 | {
13 | [ProgId("AboutBruTileCommand")]
14 | public sealed class AboutBruTileCommand : BaseCommand
15 | {
16 | private IApplication _application;
17 |
18 | public AboutBruTileCommand()
19 | {
20 | m_category = "BruTile";
21 | m_caption = "&About ArcBruTile...";
22 | m_message = "About BruTile...";
23 | m_toolTip = m_caption;
24 | m_name = "AboutBruTileCommand";
25 | }
26 |
27 | public override void OnCreate(object hook)
28 | {
29 | if (hook == null)
30 | return;
31 |
32 | _application = hook as IApplication;
33 |
34 | //Disable if it is not ArcMap
35 | if (hook is IMxApplication)
36 | m_enabled = true;
37 | else
38 | m_enabled = false;
39 | }
40 |
41 | public override void OnClick()
42 | {
43 | //var bruTileAboutBox = new BruTileAboutBox();
44 | //bruTileAboutBox.ShowDialog(new ArcMapWindow(_application));
45 |
46 | var fileCache = new FileCache(@"c:\aaa\tiles", "png");
47 | var osmTileSource = new OsmTileSource();
48 | var mxdoc = (IMxDocument)_application.Document;
49 | var map = mxdoc.FocusMap;
50 | var brutileCustomLayer = new BruTileCustomLayer(_application, osmTileSource,fileCache) {Name = "testlayer"};
51 | map.AddLayer(brutileCustomLayer);
52 |
53 |
54 | }
55 | }
56 | }
57 |
58 |
59 |
60 |
61 |
--------------------------------------------------------------------------------
/TrafficSpider/BruTile/Wmts/WmtsRequest.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) BruTile developers team. All rights reserved. See License.txt in the project root for license information.
2 |
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Globalization;
6 | using System.Linq;
7 | using System.Text;
8 | using BruTile.Web;
9 |
10 | namespace BruTile.Wmts
11 | {
12 | public class WmtsRequest : IRequest
13 | {
14 | public const string XTag = "{TileCol}";
15 | public const string YTag = "{TileRow}";
16 | public const string ZTag = "{TileMatrix}";
17 | public const string TileMatrixSetTag = "{TileMatrixSet}";
18 | public const string StyleTag = "{Style}";
19 |
20 | private readonly List _resourceUrls;
21 | private int _resourceUrlCounter;
22 | private readonly object _syncLock = new object();
23 |
24 | public WmtsRequest(IEnumerable resourceUrls)
25 | {
26 | _resourceUrls = resourceUrls.ToList();
27 | }
28 |
29 | public Uri GetUri(TileInfo info)
30 | {
31 | var urlFormatter = GetNextServerNode();
32 | var stringBuilder = new StringBuilder(urlFormatter.Template);
33 |
34 | stringBuilder.Replace(XTag, info.Index.Col.ToString(CultureInfo.InvariantCulture));
35 | stringBuilder.Replace(YTag, info.Index.Row.ToString(CultureInfo.InvariantCulture));
36 | stringBuilder.Replace(ZTag, info.Index.Level);
37 |
38 | return new Uri(stringBuilder.ToString());
39 | }
40 |
41 | private ResourceUrl GetNextServerNode()
42 | {
43 | lock (_syncLock)
44 | {
45 | var serverNode = _resourceUrls[_resourceUrlCounter++];
46 | if (_resourceUrlCounter >= _resourceUrls.Count) _resourceUrlCounter = 0;
47 | return serverNode;
48 | }
49 | }
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/TrafficSpider/BruTile/Tms/Root.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) BruTile developers team. All rights reserved. See License.txt in the project root for license information.
2 |
3 | using System;
4 | using System.Collections.Generic;
5 | using System.IO;
6 | using System.Linq;
7 | using System.Xml.Linq;
8 |
9 | namespace BruTile.Tms
10 | {
11 | public class Root
12 | {
13 | public IEnumerable TileMapServices { get; set; }
14 |
15 | public static Root CreateFromResource(Stream result)
16 | {
17 | XDocument xml = XDocument.Parse(new StreamReader(result).ReadToEnd());
18 |
19 | var services = new Root();
20 | if (xml.Root != null)
21 | {
22 | services.TileMapServices =
23 | from tileMapService in xml.Root.Descendants("TileMapService")
24 | select new TileMapServiceItem
25 | {
26 | Href =
27 | (tileMapService.Attribute("href") != null)
28 | ? tileMapService.Attribute("href").Value
29 | : String.Empty,
30 | Title =
31 | (tileMapService.Attribute("title") != null)
32 | ? tileMapService.Attribute("title").Value
33 | : String.Empty,
34 | Version =
35 | (tileMapService.Attribute("version") != null)
36 | ? tileMapService.Attribute("version").Value
37 | : String.Empty,
38 | };
39 |
40 | }
41 | return services;
42 | }
43 | }
44 |
45 | public class TileMapServiceItem
46 | {
47 | public string Href { get; set; }
48 | public string Version { get; set; }
49 | public string Title { get; set; }
50 | }
51 | }
--------------------------------------------------------------------------------
/TrafficSpider/BruTile/Wms/Keyword.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) BruTile developers team. All rights reserved. See License.txt in the project root for license information.
2 |
3 | using System.Xml;
4 | using System.Xml.Linq;
5 |
6 | namespace BruTile.Wms
7 | {
8 | public class Keyword : XmlObject
9 | {
10 | public string Vocabulary { get; set; }
11 |
12 | public string Value { get; set; }
13 |
14 | public Keyword()
15 | {
16 | }
17 |
18 | public Keyword(XElement node, string @namespace)
19 | {
20 | var att = node.Attribute(XName.Get("Vocabulary", @namespace));
21 | Vocabulary = att != null ? att.Value : string.Empty;
22 |
23 | Value = node.Value;
24 | }
25 |
26 | #region Overrides of XmlObject
27 |
28 | public override void ReadXml(XmlReader reader)
29 | {
30 | reader.MoveToContent();
31 | Vocabulary = reader.GetAttribute("vocabulary");
32 | var isEmpty = reader.IsEmptyElement;
33 | reader.ReadStartElement();
34 | if (!isEmpty)
35 | {
36 | Value = reader.ReadContentAsString();
37 | reader.ReadEndElement();
38 | }
39 | }
40 |
41 | public override void WriteXml(XmlWriter writer)
42 | {
43 | if (string.IsNullOrEmpty(Vocabulary))
44 | writer.WriteAttributeString("vocabulary", Vocabulary);
45 | writer.WriteString(Value);
46 | }
47 |
48 | public override XElement ToXElement(string @namespace)
49 | {
50 | if (string.IsNullOrEmpty(Vocabulary))
51 | return new XElement(XName.Get("Keyword", @namespace), Value);
52 |
53 | return new XElement(XName.Get("Keyword", @namespace),
54 | new XAttribute(XName.Get("vocabulary"), Vocabulary), Value);
55 | }
56 |
57 | #endregion Overrides of XmlObject
58 | }
59 | }
--------------------------------------------------------------------------------
/TrafficSpider/BruTile/Web/OsmTileSource.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) BruTile developers team. All rights reserved. See License.txt in the project root for license information.
2 |
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Globalization;
6 | using BruTile.Cache;
7 | using BruTile.Predefined;
8 |
9 | namespace BruTile.Web
10 | {
11 | [Obsolete("Replaced with HttpTileSource")]
12 | public class OsmTileSource : TileSource
13 | {
14 | public OsmTileSource(OsmRequest osmRequest = null,
15 | IPersistentCache persistentCache = null,
16 | Func fetchTile = null)
17 | : base(new WebTileProvider(
18 | osmRequest ?? new OsmRequest(KnownTileSource.OpenCycleMap),
19 | persistentCache,
20 | fetchTile),
21 | new SphericalMercatorInvertedWorldSchema())
22 | {
23 | if (osmRequest == null) osmRequest = new OsmRequest(KnownTileSource.OpenCycleMap);
24 | var resolutionsToDelete = new List();
25 | var resolutions = Schema.Resolutions;
26 | for (var i = 0; i < resolutions.Count; i++)
27 | {
28 | var id = int.Parse(resolutions[i.ToString(CultureInfo.InvariantCulture)].Id);
29 | if (id < osmRequest.OsmConfig.MinResolution || id > osmRequest.OsmConfig.MaxResolution)
30 | {
31 | //System.Diagnostics.Debug.WriteLine(string.Format("must remove resolution at index {0}", i));
32 | resolutionsToDelete.Add(i);
33 | }
34 | }
35 |
36 | int numDeleted = 0;
37 | foreach (var i in resolutionsToDelete)
38 | {
39 | resolutions.Remove((i - numDeleted++).ToString(CultureInfo.InvariantCulture));
40 | }
41 | }
42 |
43 | public Extent Extent { get { return Schema.Extent; } }
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/TrafficSpider/BruTile/Wms/Exception.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) BruTile developers team. All rights reserved. See License.txt in the project root for license information.
2 |
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Xml;
6 | using System.Xml.Linq;
7 |
8 | namespace BruTile.Wms
9 | {
10 | public class Exception : XmlObject
11 | {
12 | public Exception()
13 | {
14 | Format = new List();
15 | }
16 |
17 | public Exception(XElement node, string @namespace)
18 | {
19 | foreach (var format in node.Elements(XName.Get("Format", @namespace)))
20 | Format.Add(format.Value);
21 | }
22 |
23 | public List Format { get; private set; }
24 |
25 | #region Overrides of XmlObject
26 |
27 | public override void ReadXml(XmlReader reader)
28 | {
29 | if (CheckEmptyNode(reader, "Exception", Namespace))
30 | return;
31 |
32 | while (!reader.EOF)
33 | {
34 | if (reader.IsStartElement())
35 | {
36 | if (reader.LocalName == "Format")
37 | Format.Add(reader.ReadElementContentAsString());
38 | else
39 | reader.Skip();
40 | }
41 | else
42 | {
43 | reader.Read();
44 | }
45 | }
46 | }
47 |
48 | public override void WriteXml(XmlWriter writer)
49 | {
50 | WriteXmlList("Format", Namespace, writer, Format);
51 | }
52 |
53 | public override XElement ToXElement(string @namespace)
54 | {
55 | return new XElement(XName.Get("Exception", Namespace),
56 | Format.Select(format => new XElement(XName.Get("Format", Namespace), format)).ToArray());
57 | }
58 |
59 | #endregion Overrides of XmlObject
60 | }
61 | }
--------------------------------------------------------------------------------
/TrafficSpider/BruTile/Wms/Identifier.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) BruTile developers team. All rights reserved. See License.txt in the project root for license information.
2 |
3 | using System.Xml;
4 | using System.Xml.Linq;
5 |
6 | namespace BruTile.Wms
7 | {
8 | public class Identifier : XmlObject
9 | {
10 | public Identifier()
11 | {
12 | }
13 |
14 | public Identifier(XElement el, string ns)
15 | {
16 | var att = el.Attribute("authority");
17 | Authority = att != null ? att.Value : string.Empty;
18 |
19 | Value = el.Value;
20 | }
21 |
22 | public string Authority { get; set; }
23 |
24 | [System.Xml.Serialization.XmlTextAttribute]
25 | public string Value { get; set; }
26 |
27 | #region Overrides of XmlObject
28 |
29 | public override void ReadXml(XmlReader reader)
30 | {
31 | reader.MoveToContent();
32 | Authority = reader.GetAttribute("authority");
33 | var isEmpty = reader.IsEmptyElement;
34 | reader.ReadStartElement();
35 | if (!isEmpty)
36 | {
37 | Value = reader.ReadContentAsString();
38 | reader.ReadEndElement();
39 | }
40 | }
41 |
42 | public override void WriteXml(XmlWriter writer)
43 | {
44 | if (!string.IsNullOrEmpty(Authority))
45 | writer.WriteAttributeString("authority", Authority);
46 | writer.WriteString(Value);
47 | }
48 |
49 | public override XElement ToXElement(string @namespace)
50 | {
51 | if (string.IsNullOrEmpty(Authority))
52 | return new XElement(XName.Get("Identifier", @namespace), Value);
53 | return new XElement(XName.Get("Identifier", @namespace),
54 | new XAttribute(XName.Get("authority"), Authority), Value);
55 | }
56 |
57 | #endregion Overrides of XmlObject
58 | }
59 | }
--------------------------------------------------------------------------------
/TrafficSpider/DownloadTiles/ConfigHelper.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using BruTile.Web;
6 | using BrutileArcGIS.Lib;
7 |
8 | namespace DownloadTiles
9 | {
10 | public class ConfigHelper
11 | {
12 | public static IConfig GetTmsConfig(string url, bool overwriteUrls)
13 | {
14 | return new ConfigTms(url, overwriteUrls);
15 | }
16 |
17 | public static IConfig GetConfig(EnumBruTileLayer enumBruTileLayer, string url, bool overwriteUrls)
18 | {
19 | IConfig result;
20 |
21 | if (enumBruTileLayer == EnumBruTileLayer.TMS)
22 | {
23 | result = new ConfigTms(url, overwriteUrls);
24 | }
25 | else if (enumBruTileLayer == EnumBruTileLayer.InvertedTMS)
26 | {
27 | result = new ConfigInvertedTMS(url);
28 | }
29 | else
30 | {
31 | result = new ConfigOsm(OsmMapType.Default);
32 | }
33 |
34 | return result;
35 | }
36 |
37 | public static IConfig GetConfig(EnumBruTileLayer enumBruTileLayer)
38 | {
39 | IConfig result = new ConfigOsm(OsmMapType.Default);
40 |
41 | if (enumBruTileLayer == EnumBruTileLayer.OSM)
42 | {
43 | result = new ConfigOsm(OsmMapType.Default);
44 | }
45 | else if (enumBruTileLayer == EnumBruTileLayer.BingRoad)
46 | {
47 | result = new ConfigBing(BingMapType.Roads);
48 | }
49 | else if (enumBruTileLayer == EnumBruTileLayer.BingHybrid)
50 | {
51 | result = new ConfigBing(BingMapType.Hybrid);
52 | }
53 | else if (enumBruTileLayer == EnumBruTileLayer.BingAerial)
54 | {
55 | result = new ConfigBing(BingMapType.Aerial);
56 | }
57 | return result;
58 | }
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/TrafficSpider/BruTile/Wms/OnlineResource.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) BruTile developers team. All rights reserved. See License.txt in the project root for license information.
2 |
3 | using System.Xml;
4 | using System.Xml.Linq;
5 |
6 | namespace BruTile.Wms
7 | {
8 | public class OnlineResource : XmlObject
9 | {
10 | public OnlineResource()
11 | {
12 | Type = "simple";
13 | }
14 |
15 | public OnlineResource(XElement node, string nameSpace)
16 | {
17 | var att = node.Attribute(XName.Get("href", WmsNamespaces.Xlink));
18 | Href = att.Value;
19 | att = node.Attribute(XName.Get("type", WmsNamespaces.Xlink));
20 | if (att != null)
21 | Type = att.Value;
22 | }
23 |
24 | public override XElement ToXElement(string nameSpace)
25 | {
26 | return new XElement(XName.Get("OnlineResource", nameSpace),
27 | new XAttribute(XName.Get("href", WmsNamespaces.Xlink), Href),
28 | new XAttribute(XName.Get("type"), Type));
29 | }
30 |
31 | [System.Xml.Serialization.XmlAttribute]
32 | public string Href { get; set; }
33 |
34 | public string Type { get; set; }
35 |
36 | #region Overrides of XmlObject
37 |
38 | public override void ReadXml(XmlReader reader)
39 | {
40 | reader.MoveToContent();
41 | Href = reader.GetAttribute("href", WmsNamespaces.Xlink);
42 | Type = reader.GetAttribute("type");
43 | var isEmptyElement = reader.IsEmptyElement;
44 | reader.ReadStartElement();
45 | if (!isEmptyElement)
46 | reader.ReadEndElement();
47 | }
48 |
49 | public override void WriteXml(XmlWriter writer)
50 | {
51 | writer.WriteAttributeString("href", WmsNamespaces.Xlink, Href);
52 | writer.WriteAttributeString("type", Type);
53 | }
54 |
55 | #endregion Overrides of XmlObject
56 | }
57 | }
--------------------------------------------------------------------------------
/TrafficSpider/BruTile/PreDefined/SphericalMercatorWorldSchema.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) BruTile developers team. All rights reserved. See License.txt in the project root for license information.
2 |
3 | using System;
4 | using System.Globalization;
5 |
6 | namespace BruTile.Predefined
7 | {
8 | [Obsolete("Use GlobalSphericalMercator(YAxis.TMS) instead")]
9 | public class SphericalMercatorWorldSchema : TileSchema
10 | {
11 | public SphericalMercatorWorldSchema()
12 | {
13 | var resolutions = new[] {
14 | 156543.033900000, 78271.516950000, 39135.758475000, 19567.879237500,
15 | 9783.939618750, 4891.969809375, 2445.984904688, 1222.992452344,
16 | 611.496226172, 305.748113086, 152.874056543, 76.437028271,
17 | 38.218514136, 19.109257068, 9.554628534, 4.777314267,
18 | 2.388657133, 1.194328567, 0.597164283};
19 |
20 | var count = 0;
21 | foreach (var resolution in resolutions)
22 | {
23 | var levelId = count.ToString(CultureInfo.InvariantCulture);
24 | var ms = (int) Math.Pow(count, 2) / 2;
25 | Resolutions[levelId] = new Resolution
26 | {
27 | Id = levelId,
28 | UnitsPerPixel = resolution,
29 | Left = -20037508.342789,
30 | Top = 20037508.342789,
31 | TileWidth = 256,
32 | TileHeight = 256,
33 | MatrixWidth = ms,
34 | MatrixHeight = ms
35 | };
36 | count++;
37 | }
38 | Height = 256;
39 | Width = 256;
40 | Extent = new Extent(-20037508.342789, -20037508.342789, 20037508.342789, 20037508.342789);
41 | OriginX = -20037508.342789;
42 | OriginY = -20037508.342789;
43 | Name = "WorldSphericalMercator";
44 | Format = "png";
45 | YAxis = YAxis.TMS;
46 | Srs = "EPSG:3857";
47 | }
48 | }
49 | }
--------------------------------------------------------------------------------
/TrafficSpider/app/lib/CacheDirectory.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using BruTile.Cache;
3 | using BrutileArcGIS.Lib;
4 |
5 | namespace BrutileArcGIS.lib
6 | {
7 | public class CacheDirectory
8 | {
9 | public static FileCache GetFileCache(string baseCacheDir, IConfig config,EnumBruTileLayer enumBruTileLayer)
10 | {
11 | var schema = config.CreateTileSource().Schema;
12 |
13 | var cacheDirType = GetCacheDirectory(config, enumBruTileLayer, baseCacheDir);
14 |
15 | var format = schema.Format;
16 |
17 | if (format.Contains(@"image/"))
18 | {
19 | format = format.Substring(6, schema.Format.Length - 6);
20 | }
21 | if (format.Contains("png8"))
22 | {
23 | format = format.Replace("png8", "png");
24 | }
25 | var fileCache = new FileCache(cacheDirType, format);
26 |
27 | return fileCache;
28 |
29 | }
30 |
31 | private static string GetCacheDirectory(IConfig config, EnumBruTileLayer layerType, string baseCacheDir)
32 | {
33 | string cacheDirectory = String.Format("{0}{1}{2}", baseCacheDir, System.IO.Path.DirectorySeparatorChar, layerType);
34 |
35 | if (layerType == EnumBruTileLayer.TMS || layerType == EnumBruTileLayer.InvertedTMS)
36 | {
37 | string url = (layerType == EnumBruTileLayer.TMS ? ((ConfigTms)config).Url : ((ConfigInvertedTMS)config).Url);
38 |
39 | string service = url.Substring(7, url.Length - 7);
40 | service = service.Replace(@"/", "-");
41 | service = service.Replace(":", "-");
42 |
43 | if (service.EndsWith("-"))
44 | {
45 | service = service.Substring(0, service.Length - 1);
46 | }
47 | cacheDirectory = String.Format("{0}{1}{2}{3}{4}", baseCacheDir, System.IO.Path.DirectorySeparatorChar, layerType, System.IO.Path.DirectorySeparatorChar, service);
48 | }
49 |
50 | return cacheDirectory;
51 | }
52 |
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/TrafficSpider/DownloadTiles/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/TrafficSpider/app/forms/AddWmsCForm.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Windows.Forms;
5 | using BruTile;
6 | using BruTile.Wmsc;
7 |
8 | namespace BrutileArcGIS.forms
9 | {
10 | public partial class AddWmsCForm : Form
11 | {
12 | private IList _tileSources;
13 |
14 | public ITileSource SelectedTileSource;
15 |
16 | public AddWmsCForm()
17 | {
18 | InitializeComponent();
19 | }
20 |
21 | private void btnOk_Click(object sender, EventArgs e)
22 | {
23 | DialogResult = DialogResult.OK;
24 | }
25 |
26 | private void btnRetrieve_Click(object sender, EventArgs e)
27 | {
28 | // Complete sample urrel:
29 | // http://labs.metacarta.com/wms-c/tilecache.py?version=1.1.1&request=GetCapabilities&service=wms-c
30 | // Does not work yet: http://public-wms.kaartenbalie.nl/wms/nederland
31 | //string url = String.Format("{0}?version={1}&request=GetCapabilities&service=wms-c", tbWmsCUrl.Text, cbbVersion.SelectedItem);
32 | var url = tbWmsCUrl.Text;
33 |
34 | try
35 | {
36 | _tileSources = WmscTileSource.CreateFromWmscCapabilties(new Uri(url)).ToList();
37 |
38 | var names = _tileSources.Select(t => t.Schema.Name).ToList();
39 |
40 | lbServices.DataSource = names;
41 | }
42 | catch (Exception ex)
43 | {
44 | MessageBox.Show(ex.Message);
45 | }
46 |
47 | }
48 |
49 | private void lbServices_SelectedIndexChanged(object sender, EventArgs e)
50 | {
51 | if (lbServices.SelectedItem != null)
52 | {
53 | var name = (String)lbServices.SelectedItem;
54 | foreach (var tileSource in _tileSources.Where(t => t.Schema.Name == name))
55 | {
56 | SelectedTileSource = tileSource;
57 | }
58 | btnOk.Enabled = true;
59 | }
60 | }
61 | }
62 |
63 | }
--------------------------------------------------------------------------------
/TrafficSpider/app/commands/AddBruTileLayerCommandBase.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Drawing;
3 | using System.Windows.Forms;
4 | using BrutileArcGIS.Lib;
5 | using ESRI.ArcGIS.ADF.BaseClasses;
6 | using ESRI.ArcGIS.ArcMapUI;
7 | using ESRI.ArcGIS.Framework;
8 |
9 | namespace BrutileArcGIS.commands
10 | {
11 | public class AddBruTileLayerCommandBase : BaseCommand
12 | {
13 | private IApplication _application;
14 | private readonly EnumBruTileLayer _enumBruTileLayer;
15 |
16 | public AddBruTileLayerCommandBase(string category, string caption, string message, string name, Bitmap bitmap, EnumBruTileLayer enumBruTileLayer)
17 | {
18 | m_category = category;
19 | m_caption = caption;
20 | m_message = message;
21 | m_toolTip = message;
22 | m_name = name;
23 | m_bitmap = bitmap;
24 | _enumBruTileLayer = enumBruTileLayer;
25 | }
26 |
27 | public override bool Enabled
28 | {
29 | get
30 | {
31 | return true;
32 | }
33 | }
34 |
35 | public override void OnCreate(object hook)
36 | {
37 | if (hook == null)
38 | return;
39 |
40 | _application = hook as IApplication;
41 |
42 | //Disable if it is not ArcMap
43 | if (hook is IMxApplication)
44 | m_enabled = true;
45 | else
46 | m_enabled = false;
47 | }
48 |
49 | public override void OnClick()
50 | {
51 | try
52 | {
53 | var mxdoc = (IMxDocument)_application.Document;
54 | var map = mxdoc.FocusMap;
55 | var brutileLayer = new BruTileLayer(_application, _enumBruTileLayer)
56 | {
57 | Name = m_name,
58 | Visible = true
59 | };
60 |
61 | map.AddLayer(brutileLayer);
62 | }
63 | catch (Exception ex)
64 | {
65 | MessageBox.Show(ex.ToString());
66 | }
67 | }
68 | }
69 |
70 | }
71 |
--------------------------------------------------------------------------------
/TrafficSpider/BruTile.Desktop/Web/GoogleTileSource.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) BruTile developers team. All rights reserved. See License.txt in the project root for license information.
2 |
3 | // This file was created by Felix Obermaier (www.ivv-aachen.de) 2010.
4 |
5 | using System;
6 | using System.Net;
7 | using BruTile.Cache;
8 | using BruTile.Predefined;
9 |
10 | namespace BruTile.Web
11 | {
12 | [Serializable]
13 | [Obsolete("This component was built on Google Maps API V2 which is no longer supported: https://developers.google.com/maps/documentation/javascript/v2/basics")]
14 | public class GoogleTileSource : ITileSource
15 | {
16 | private readonly SphericalMercatorInvertedWorldSchema _tileSchema;
17 | private readonly WebTileProvider _tileProvider;
18 | public const string UserAgent = @"Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.1.7) Gecko/20091221 Firefox/3.5.7";
19 | public const string Referer = "http://maps.google.com/";
20 |
21 | public GoogleTileSource(GoogleMapType mapType)
22 | : this(new GoogleRequest(mapType))
23 | {
24 | }
25 |
26 | public GoogleTileSource(GoogleRequest request, IPersistentCache persistentCache = null)
27 | {
28 | _tileSchema = new SphericalMercatorInvertedWorldSchema();
29 | _tileProvider = new WebTileProvider(request, persistentCache,
30 | // The Google requests needs to fake the UserAgent en Referer.
31 | uri =>
32 | {
33 | var httpWebRequest = (HttpWebRequest) WebRequest.Create(uri);
34 | httpWebRequest.UserAgent = UserAgent;
35 | httpWebRequest.Referer = Referer;
36 | return RequestHelper.FetchImage(httpWebRequest);
37 | });
38 | }
39 |
40 | public ITileProvider Provider
41 | {
42 | get { return _tileProvider; }
43 | }
44 |
45 | public ITileSchema Schema
46 | {
47 | get { return _tileSchema; }
48 | }
49 |
50 | public string Name { get; private set; }
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/TrafficSpider/app/lib/CacheSettings.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Configuration;
3 | using System.IO;
4 |
5 | namespace BrutileArcGIS.Lib
6 | {
7 | public static class CacheSettings
8 | {
9 | public static string GetServicesConfigDir()
10 | {
11 | var config = ConfigurationHelper.GetConfig();
12 | var servicesConfigDir = config.AppSettings.Settings["servicesConfigDir"].Value;
13 | if (servicesConfigDir.Contains("%"))
14 | {
15 | servicesConfigDir = ReplaceEnvironmentVar(servicesConfigDir);
16 | }
17 |
18 | if (!Directory.Exists(servicesConfigDir))
19 | {
20 | Directory.CreateDirectory(servicesConfigDir);
21 | }
22 |
23 | return servicesConfigDir;
24 | }
25 |
26 | public static string GetCacheFolder()
27 | {
28 | var config = ConfigurationHelper.GetConfig();
29 | var tileDir = @"D:\我的文件\天津师大切片解决方案\Tiles\GZ";
30 | if (tileDir.Contains("%"))
31 | {
32 | tileDir = ReplaceEnvironmentVar(tileDir);
33 | }
34 |
35 | return tileDir;
36 | }
37 |
38 | public static string GetCacheFolder(string tileDir)
39 | {
40 | var config=ConfigurationHelper.GetConfig();
41 | //var tileDir = @"D:\我的文件\天津师大切片解决方案\Tiles\GZ";
42 | if(tileDir.Contains("%"))
43 | {
44 | tileDir = ReplaceEnvironmentVar(tileDir);
45 | }
46 |
47 | return tileDir;
48 | }
49 |
50 | private static string ReplaceEnvironmentVar(string path)
51 | {
52 | var firstIndex = path.IndexOf("%", StringComparison.Ordinal);
53 | var lastIndex = path.LastIndexOf("%", StringComparison.Ordinal);
54 | var envVar = path.Substring(firstIndex+1, lastIndex - firstIndex-1);
55 | var environmentVariable = Environment.GetEnvironmentVariable(envVar);
56 | path = path.Replace("%"+envVar+"%", environmentVariable);
57 | return path;
58 | }
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/TrafficSpider/app/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/TrafficSpider/app/lib/FileCacheExtensionMethods.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Globalization;
3 | using System.IO;
4 | using BruTile;
5 | using BruTile.Cache;
6 |
7 | namespace BrutileArcGIS.lib
8 | {
9 | public static class ExtensionMethods
10 | {
11 | public static void AddWorldFile(this FileCache fileCache, TileInfo tileInfo, int width, int height, string format)
12 | {
13 | var fileName = fileCache.GetFileName(tileInfo.Index);
14 | var fi = new FileInfo(fileName);
15 |
16 | var tfwFile = fileName.Replace(fi.Extension, "." + GetWorldFile(format));
17 |
18 | var extent = tileInfo.Extent;
19 |
20 | using (var sw = new StreamWriter(tfwFile))
21 | {
22 | var resX = (extent.MaxX - extent.MinX) / width;
23 | var resY = (extent.MaxY - extent.MinY) / height;
24 | sw.WriteLine(resX.ToString(CultureInfo.InvariantCulture));
25 | sw.WriteLine("0");
26 | sw.WriteLine("0");
27 | sw.WriteLine((resY * -1).ToString(CultureInfo.InvariantCulture));
28 | sw.WriteLine(extent.MinX.ToString(CultureInfo.InvariantCulture));
29 | sw.WriteLine(extent.MaxY.ToString(CultureInfo.InvariantCulture));
30 | sw.Close();
31 | }
32 |
33 | }
34 |
35 | private static string GetWorldFile(string format)
36 | {
37 | var res = String.Empty;
38 |
39 | format = (format.Contains(@"image/") ? format.Substring(6, format.Length - 6) : format);
40 |
41 | if (format == "jpg")
42 | {
43 | res = "jgw";
44 | }
45 | if (format == "jpeg")
46 | {
47 | res = "jgw";
48 | }
49 | else if (format == "png")
50 | {
51 | res = "pgw";
52 | }
53 | else if (format == "png8")
54 | {
55 | res = "pgw";
56 | }
57 |
58 | else if (format == "tif")
59 | {
60 | res = "tfw";
61 | }
62 |
63 | return res;
64 |
65 | }
66 |
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/TrafficSpider/app/commands/AddTmsLayerCommandBase.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Drawing;
3 | using System.Windows.Forms;
4 | using BrutileArcGIS.Lib;
5 | using ESRI.ArcGIS.ADF.BaseClasses;
6 | using ESRI.ArcGIS.ArcMapUI;
7 | using ESRI.ArcGIS.Framework;
8 |
9 | namespace BrutileArcGIS.commands
10 | {
11 | public class AddTmsLayerCommandBase : BaseCommand
12 | {
13 | private IApplication _application;
14 | private readonly string _url;
15 | private readonly EnumBruTileLayer _enumBruTileLayer;
16 |
17 | public AddTmsLayerCommandBase(string category, string caption, string message, string name, Bitmap bitmap, string url, EnumBruTileLayer enumBruTileLayer)
18 | {
19 | m_category = category;
20 | m_caption = caption;
21 | m_message = message;
22 | m_toolTip = message;
23 | m_name = name;
24 | m_bitmap = bitmap;
25 | _url = url;
26 | _enumBruTileLayer = enumBruTileLayer;
27 | }
28 |
29 | public override bool Enabled
30 | {
31 | get
32 | {
33 | return true;
34 | }
35 | }
36 |
37 | public override void OnCreate(object hook)
38 | {
39 | if (hook == null)
40 | return;
41 |
42 | _application = hook as IApplication;
43 |
44 | //Disable if it is not ArcMap
45 | if (hook is IMxApplication)
46 | m_enabled = true;
47 | else
48 | m_enabled = false;
49 | }
50 |
51 | public override void OnClick()
52 | {
53 | try
54 | {
55 | var mxdoc = (IMxDocument)_application.Document;
56 | var map = mxdoc.FocusMap;
57 | var brutileLayer = new BruTileLayer(_application, _enumBruTileLayer, _url, true)
58 | {
59 | Name = m_name,
60 | Visible = true
61 | };
62 |
63 | map.AddLayer(brutileLayer);
64 | }
65 | catch (Exception ex)
66 | {
67 | MessageBox.Show(ex.ToString());
68 | }
69 | }
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/TrafficSpider/BruTile/Wms/DCPTypeElement.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) BruTile developers team. All rights reserved. See License.txt in the project root for license information.
2 |
3 | using System.Xml;
4 | using System.Xml.Linq;
5 |
6 | namespace BruTile.Wms
7 | {
8 | public class DCPTypeElement : XmlObject
9 | {
10 | private readonly string _name;
11 |
12 | public string Name
13 | {
14 | get { return _name; }
15 | }
16 |
17 | private OnlineResource _onlineResourceField;
18 |
19 | protected DCPTypeElement(string name)
20 | {
21 | _name = name;
22 | }
23 |
24 | protected DCPTypeElement(string name, XElement node, string @namespace)
25 | : this(name)
26 | {
27 | var element = node.Element(XName.Get("OnlineResource", @namespace));
28 | if (element != null)
29 | OnlineResource = new OnlineResource(element, @namespace);
30 | }
31 |
32 | public OnlineResource OnlineResource
33 | {
34 | get
35 | {
36 | if ((_onlineResourceField == null))
37 | {
38 | _onlineResourceField = new OnlineResource();
39 | }
40 | return _onlineResourceField;
41 | }
42 | set
43 | {
44 | _onlineResourceField = value;
45 | }
46 | }
47 |
48 | #region Overrides of XmlObject
49 |
50 | public override void ReadXml(XmlReader reader)
51 | {
52 | if (CheckEmptyNode(reader, _name, Namespace))
53 |
54 | OnlineResource = new OnlineResource();
55 | OnlineResource.ReadXml(reader);
56 | reader.ReadEndElement();
57 | }
58 |
59 | public override void WriteXml(XmlWriter writer)
60 | {
61 | WriteXmlItem(_name, Namespace, writer, OnlineResource);
62 | }
63 |
64 | public override XElement ToXElement(string @namespace)
65 | {
66 | return new XElement(XName.Get(_name, @namespace),
67 | OnlineResource.ToXElement(@namespace));
68 | }
69 |
70 | #endregion Overrides of XmlObject
71 | }
72 | }
--------------------------------------------------------------------------------
/TrafficSpider/BruTile/Wms/Schema/ReadMe.txt:
--------------------------------------------------------------------------------
1 | OpenGIS(r) WMS schema - ReadMe.txt
2 | ==================================
3 |
4 | OpenGIS(r) Web Feature Service (WMS) Implementation Standard
5 | -------------------------------------------------------------------
6 |
7 | The OpenGIS(r) Web Map Service Interface Standard (WMS) provides a simple HTTP
8 | interface for requesting geo-registered map images from one or more distributed
9 | geospatial databases. A WMS request defines the geographic layer(s) and area of
10 | interest to be processed. The response to the request is one or more
11 | geo-registered map images (returned as JPEG, PNG, etc) that can be displayed in
12 | a browser application. The interface also supports the ability to specify
13 | whether the returned images should be transparent so that layers from multiple
14 | servers can be combined or not.
15 |
16 | More information may be found at
17 | http://www.opengeospatial.org/standards/wms
18 |
19 | The most current schema are available at http://schemas.opengis.net/ .
20 |
21 | -----------------------------------------------------------------------
22 |
23 | 2010-02-03 Kevin Stegemoller
24 |
25 | * v1.3.0: updated xsd:schema:@version to 1.3.0 2010-02-03 (06-135r7 s#13.4)
26 | * v1.3.0:
27 | + updated xsd:schema:@version attribute (06-135r7 s#13.4)
28 | + update relative schema imports to absolute URLs (06-135r7 s#15)
29 | + update/verify copyright (06-135r7 s#3.2)
30 | + add archives (.zip) files of previous versions
31 | + create/update ReadMe.txt (06-135r7 s#17)
32 |
33 | 2005-11-22 Arliss Whiteside
34 |
35 | * v1.3.0: This set of XML Schema Documents for WMS have been edited to
36 | reflect the corrigendum to document OGC 04-024 (WMS 1.3.0) that are based
37 | on the change requests:
38 | OGC 05-068r1 "Store xlinks.xsd file at a fixed location"
39 | OGC 05-081r2 "Change to use relative paths"
40 |
41 | Note: check each OGC numbered document for detailed changes.
42 |
43 | -----------------------------------------------------------------------
44 |
45 | Policies, Procedures, Terms, and Conditions of OGC(r) are available
46 | http://www.opengeospatial.org/ogc/legal/ .
47 |
48 | Copyright (c) 2010 Open Geospatial Consortium, Inc. All Rights Reserved.
49 |
50 | -----------------------------------------------------------------------
51 |
52 |
--------------------------------------------------------------------------------
/TrafficSpider/BruTile/Wmts/ScaleSet.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) BruTile developers team. All rights reserved. See License.txt in the project root for license information.
2 |
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Linq;
6 |
7 | namespace BruTile.Wmts
8 | {
9 | ///
10 | /// A set of scales
11 | ///
12 | internal class ScaleSet
13 | {
14 | ///
15 | /// The items
16 | ///
17 | private readonly ScaleSetItem[] _items;
18 |
19 | ///
20 | /// Creates an instance for this class
21 | ///
22 | ///
23 | ///
24 | ///
25 | public ScaleSet(string name, CrsIdentifier crs, IEnumerable items)
26 | {
27 | Name = name;
28 | Crs = crs;
29 | _items = items.ToArray();
30 | }
31 |
32 | ///
33 | /// Gets the Crs identifier for this scale set
34 | ///
35 | public CrsIdentifier Crs
36 | {
37 | get; private set;
38 |
39 | }
40 |
41 | ///
42 | /// Gets a value indicating the name of the scale set
43 | ///
44 | public string Name { get; private set; }
45 |
46 | ///
47 | ///
48 | ///
49 | ///
50 | ///
51 | public ScaleSetItem this[int level]
52 | {
53 | get { return _items[level]; }
54 | }
55 |
56 | ///
57 | /// Accessor to a pixel size
58 | ///
59 | ///
60 | ///
61 | public double? this[double scaleDenominator]
62 | {
63 | get
64 | {
65 | for (var i = 0; i < _items.Length; i++)
66 | {
67 | if (Math.Abs(scaleDenominator - _items[i].ScaleDenominator) < 1e-7)
68 | {
69 | return _items[i].PixelSize;
70 | }
71 | if (_items[i].ScaleDenominator < scaleDenominator) break;
72 | }
73 | return null;
74 | }
75 | }
76 | }
77 | }
--------------------------------------------------------------------------------
/TrafficSpider/DownloadTiles/LogManager.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace DownloadTiles
7 | {
8 | public class LogManager
9 | {
10 | private static string logPath = string.Empty;
11 | ///
12 | /// 保存日志的文件夹
13 | ///
14 | public static string LogPath
15 | {
16 | get
17 | {
18 | if (logPath == string.Empty)
19 | {
20 | logPath = AppDomain.CurrentDomain.BaseDirectory;
21 | }
22 | return logPath;
23 | }
24 | set
25 | {
26 | logPath = value;
27 | if (System.IO.Directory.Exists(logPath) == false)//如果不存在就创建file文件夹
28 | {
29 | System.IO.Directory.CreateDirectory(logPath);
30 | }
31 | }
32 | }
33 |
34 | private static string logFielPrefix = string.Empty;
35 | ///
36 | /// 日志文件前缀
37 | ///
38 | public static string LogFielPrefix
39 | {
40 | get { return logFielPrefix; }
41 | set { logFielPrefix = value; }
42 | }
43 |
44 | ///
45 | /// 写日志
46 | ///
47 | public static void WriteLog(string logFile, string msg)
48 | {
49 | try
50 | {
51 | System.IO.StreamWriter sw = System.IO.File.AppendText(
52 | LogPath + LogFielPrefix + logFile + "_" +
53 | DateTime.Now.ToString("yyyyMMdd") + ".Log "
54 | );
55 | sw.WriteLine(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss: ") + msg);
56 | sw.Close();
57 | }
58 | catch
59 | { }
60 | }
61 |
62 | ///
63 | /// 写日志
64 | ///
65 | public static void WriteLog(LogFile logFile, string msg)
66 | {
67 | WriteLog(logFile.ToString(), msg);
68 | }
69 | }
70 |
71 | ///
72 | /// 日志类型
73 | ///
74 | public enum LogFile
75 | {
76 | Trace,
77 | Warning,
78 | Error,
79 | SQL
80 | }
81 | }
82 |
--------------------------------------------------------------------------------
/TrafficSpider/BruTile/Wmts/xsd/wmtsGetFeatureInfo_request.xsd:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 | wmtsGetFeatureInfo_request
10 |
11 | This XML Schema Document defines XML WMTS
12 | GetFeatureInfo request that can be used in SOAP encodings.
13 |
14 | WMTS is an OGC Standard.
15 | Copyright (c) 2009,2010 Open Geospatial Consortium.
16 | To obtain additional rights of use, visit http://www.opengeospatial.org/legal/.
17 |
18 |
19 |
22 |
24 |
25 |
26 |
29 |
30 |
31 |
32 |
33 |
34 | The corresponding GetTile request parameters
35 |
36 |
37 |
38 |
39 | Row index of a pixel in the tile
40 |
41 |
42 |
43 |
44 | Column index of a pixel in the tile
45 |
46 |
47 |
48 |
49 | Output MIME type format of the
50 | retrieved information
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/TrafficSpider/BruTile/Wmts/xsd/owsServiceProvider.xsd:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 | owsServiceProvider.xsd
9 | This XML Schema Document encodes the common "ServiceProvider" section of the GetCapabilities operation response, known as the Capabilities XML document. This section encodes the SV_ServiceProvider class of ISO 19119 (OGC Abstract Specification Topic 12).
10 |
11 | OWS is an OGC Standard.
12 | Copyright (c) 2006,2010 Open Geospatial Consortium.
13 | To obtain additional rights of use, visit http://www.opengeospatial.org/legal/ .
14 |
15 |
16 |
19 |
20 |
21 |
24 |
25 |
26 | Metadata about the organization that provides this specific service instance or server.
27 |
28 |
29 |
30 |
31 |
32 | A unique identifier for the service provider organization.
33 |
34 |
35 |
36 |
37 | Reference to the most relevant web site of the service provider.
38 |
39 |
40 |
41 |
42 | Information for contacting the service provider. The OnlineResource element within this ServiceContact element should not be used to reference a web site of the service provider.
43 |
44 |
45 |
46 |
47 |
48 |
49 |
--------------------------------------------------------------------------------
/TrafficSpider/app/lib/FetchStrategy.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using BruTile;
5 |
6 | namespace BrutileArcGIS.Lib
7 | {
8 | interface IFetchStrategy
9 | {
10 | IList GetTilesWanted(ITileSchema schema, Extent extent, string levelId);
11 | }
12 |
13 | public class FetchStrategy : IFetchStrategy
14 | {
15 | public static HashSet GetPreFetchLevels(int min, int max)
16 | {
17 | var preFetchLayers = new HashSet();
18 | var level = min;
19 | var step = 1;
20 | while (level <= max)
21 | {
22 | preFetchLayers.Add(level);
23 | level += step;
24 | step++;
25 | }
26 | return preFetchLayers;
27 | }
28 |
29 | public IList GetTilesWanted(ITileSchema schema, Extent extent, string levelId)
30 | {
31 | IList infos = new List();
32 | // Iterating through all levels from current to zero. If lower levels are
33 | // not availeble the renderer can fall back on higher level tiles.
34 | var resolution = schema.Resolutions[levelId].UnitsPerPixel;
35 | var levels = schema.Resolutions.Where(k => resolution <= k.Value.UnitsPerPixel).OrderByDescending(x => x.Value.UnitsPerPixel);
36 |
37 | //var levelCount = levels.Count();
38 | foreach (var level in levels)
39 | {
40 | var tileInfos = schema.GetTilesInView(extent, level.Key);
41 | tileInfos = SortByPriority(tileInfos, extent.CenterX, extent.CenterY);
42 |
43 | //var count = infosOfLevel.Count();
44 | foreach (var info in tileInfos)
45 | {
46 | if ((info.Index.Row >= 0) && (info.Index.Col >= 0)) infos.Add(info);
47 | }
48 | }
49 |
50 | return infos;
51 | }
52 |
53 | private static IEnumerable SortByPriority(IEnumerable tiles, double centerX, double centerY)
54 | {
55 | return tiles.OrderBy(t => Distance(centerX, centerY, t.Extent.CenterX, t.Extent.CenterY));
56 | }
57 |
58 | public static double Distance(double x1, double y1, double x2, double y2)
59 | {
60 | return Math.Sqrt(Math.Pow(x1 - x2, 2.0) + Math.Pow(y1 - y2, 2.0));
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/TrafficSpider/app/forms/FormPreCacheStatus.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace BruTileArcGIS
2 | {
3 | partial class FormPreCacheStatus
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.LabelStatus = new System.Windows.Forms.Label();
32 | this.SuspendLayout();
33 | //
34 | // LabelStatus
35 | //
36 | this.LabelStatus.AutoSize = true;
37 | this.LabelStatus.Location = new System.Drawing.Point(12, 9);
38 | this.LabelStatus.Name = "LabelStatus";
39 | this.LabelStatus.Size = new System.Drawing.Size(93, 13);
40 | this.LabelStatus.TabIndex = 0;
41 | this.LabelStatus.Text = "PreCache Status: ";
42 | //
43 | // FormPreCacheStatus
44 | //
45 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
46 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
47 | this.ClientSize = new System.Drawing.Size(270, 33);
48 | this.Controls.Add(this.LabelStatus);
49 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
50 | this.Name = "FormPreCacheStatus";
51 | this.ShowInTaskbar = false;
52 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
53 | this.Text = "PreCache Status";
54 | this.ResumeLayout(false);
55 | this.PerformLayout();
56 |
57 | }
58 |
59 | #endregion
60 |
61 | private System.Windows.Forms.Label LabelStatus;
62 | }
63 | }
--------------------------------------------------------------------------------
/TrafficSpider/BruTile/Wms/ServiceException.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) BruTile developers team. All rights reserved. See License.txt in the project root for license information.
2 |
3 | using System.Collections.Generic;
4 | using System.Xml;
5 | using System.Xml.Linq;
6 |
7 | namespace BruTile.Wms
8 | {
9 | public class ServiceException : XmlObject
10 | {
11 | public ServiceException()
12 | {
13 | }
14 |
15 | public ServiceException(XElement node, string @namespace)
16 | {
17 | var att = node.Attribute("code");
18 | Code = att != null ? att.Value : string.Empty;
19 |
20 | att = node.Attribute("locator");
21 | Locator = att != null ? att.Value : string.Empty;
22 |
23 | Value = node.Value;
24 | }
25 |
26 | public string Code
27 | {
28 | get;
29 | set;
30 | }
31 |
32 | public string Locator
33 | {
34 | get;
35 | set;
36 | }
37 |
38 | public string Value { get; set; }
39 |
40 | #region Overrides of XmlObject
41 |
42 | public override void ReadXml(XmlReader reader)
43 | {
44 | reader.MoveToContent();
45 | Code = reader.GetAttribute("code");
46 | Locator = reader.GetAttribute("locator");
47 | var isEmpty = reader.IsEmptyElement;
48 | reader.ReadStartElement();
49 | if (!isEmpty)
50 | {
51 | Value = reader.ReadContentAsString();
52 | reader.ReadEndElement();
53 | }
54 | }
55 |
56 | public override void WriteXml(XmlWriter writer)
57 | {
58 | if (!string.IsNullOrEmpty(Code))
59 | writer.WriteAttributeString("code", Code);
60 | if (!string.IsNullOrEmpty(Locator))
61 | writer.WriteAttributeString("locator", Locator);
62 | writer.WriteString(Value);
63 | }
64 |
65 | public override XElement ToXElement(string @namespace)
66 | {
67 | var att = new List();
68 | if (!string.IsNullOrEmpty(Code))
69 | att.Add(new XAttribute(XName.Get("code"), Code));
70 | if (!string.IsNullOrEmpty(Locator))
71 | att.Add(new XAttribute(XName.Get("locator"), Locator));
72 |
73 | return new XElement(XName.Get("ServiceException", @namespace), att.ToArray(), Value);
74 | }
75 |
76 | #endregion Overrides of XmlObject
77 | }
78 | }
--------------------------------------------------------------------------------
/TrafficSpider/BruTile/Wms/StyleURL.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) BruTile developers team. All rights reserved. See License.txt in the project root for license information.
2 |
3 | using System.Xml;
4 | using System.Xml.Linq;
5 |
6 | namespace BruTile.Wms
7 | {
8 | public class StyleURL : XmlObject
9 | {
10 | private OnlineResource _onlineResourceField;
11 |
12 | public StyleURL()
13 | {
14 | }
15 |
16 | public StyleURL(XElement node, string @namespace)
17 | {
18 | var element = node.Element(XName.Get("Format", @namespace));
19 | Format = element == null ? "png" : element.Value;
20 |
21 | element = node.Element(XName.Get("OnlineResource", @namespace));
22 | if (element != null)
23 | OnlineResource = new OnlineResource(element, @namespace);
24 | }
25 |
26 | public override XElement ToXElement(string @namespace)
27 | {
28 | return new XElement(XName.Get("StyleURL", @namespace),
29 | new XElement(XName.Get("Format", @namespace), Format),
30 | OnlineResource.ToXElement(@namespace));
31 | }
32 |
33 | public string Format { get; set; }
34 |
35 | public OnlineResource OnlineResource
36 | {
37 | get
38 | {
39 | if ((_onlineResourceField == null))
40 | {
41 | _onlineResourceField = new OnlineResource();
42 | }
43 | return _onlineResourceField;
44 | }
45 | set
46 | {
47 | _onlineResourceField = value;
48 | }
49 | }
50 |
51 | #region Overrides of XmlObject
52 |
53 | public override void ReadXml(XmlReader reader)
54 | {
55 | var isEmptyElement = reader.IsEmptyElement;
56 | reader.ReadStartElement();
57 | if (!isEmptyElement)
58 | {
59 | reader.ReadStartElement("Format");
60 | Format = reader.ReadContentAsString();
61 | reader.ReadEndElement();
62 | OnlineResource.ReadXml(reader);
63 | }
64 | }
65 |
66 | public override void WriteXml(XmlWriter writer)
67 | {
68 | writer.WriteElementString("Format", Format);
69 | writer.WriteStartElement("OnlineResource", Namespace);
70 | OnlineResource.WriteXml(writer);
71 | writer.WriteEndElement();
72 | }
73 |
74 | #endregion Overrides of XmlObject
75 | }
76 | }
--------------------------------------------------------------------------------
/TrafficSpider/BruTile/Wms/StyleSheetURL.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) BruTile developers team. All rights reserved. See License.txt in the project root for license information.
2 |
3 | using System.Xml;
4 | using System.Xml.Linq;
5 |
6 | namespace BruTile.Wms
7 | {
8 | public class StyleSheetURL : XmlObject
9 | {
10 | private OnlineResource _onlineResourceField;
11 |
12 | public StyleSheetURL()
13 | {
14 | }
15 |
16 | public StyleSheetURL(XElement node, string @namespace)
17 | {
18 | var element = node.Element(XName.Get("Format", @namespace));
19 | Format = element == null ? "png" : element.Value;
20 |
21 | element = node.Element(XName.Get("OnlineResource", @namespace));
22 | if (element != null)
23 | OnlineResource = new OnlineResource(element, @namespace);
24 | }
25 |
26 | public override XElement ToXElement(string @namespace)
27 | {
28 | return new XElement(XName.Get("StyleURL", @namespace),
29 | new XElement(XName.Get("Format", @namespace), Format),
30 | OnlineResource.ToXElement(@namespace));
31 | }
32 |
33 | public string Format { get; set; }
34 |
35 | public OnlineResource OnlineResource
36 | {
37 | get
38 | {
39 | if ((_onlineResourceField == null))
40 | {
41 | _onlineResourceField = new OnlineResource();
42 | }
43 | return _onlineResourceField;
44 | }
45 | set
46 | {
47 | _onlineResourceField = value;
48 | }
49 | }
50 |
51 | #region Overrides of XmlObject
52 |
53 | public override void ReadXml(XmlReader reader)
54 | {
55 | var isEmptyElement = reader.IsEmptyElement;
56 | reader.ReadStartElement();
57 | if (!isEmptyElement)
58 | {
59 | reader.ReadStartElement("Format");
60 | Format = reader.ReadContentAsString();
61 | reader.ReadEndElement();
62 | OnlineResource.ReadXml(reader);
63 | }
64 | }
65 |
66 | public override void WriteXml(XmlWriter writer)
67 | {
68 | writer.WriteElementString("Format", Format);
69 | writer.WriteStartElement("OnlineResource", Namespace);
70 | OnlineResource.WriteXml(writer);
71 | writer.WriteEndElement();
72 | }
73 |
74 | #endregion Overrides of XmlObject
75 | }
76 | }
--------------------------------------------------------------------------------
/TrafficSpider/app/commands/AddWmsCLayerCommand.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 | using System.Windows.Forms;
4 | using BrutileArcGIS.forms;
5 | using BrutileArcGIS.Lib;
6 | using BrutileArcGIS.Properties;
7 | using ESRI.ArcGIS.ADF.BaseClasses;
8 | using ESRI.ArcGIS.ArcMapUI;
9 | using ESRI.ArcGIS.Carto;
10 | using ESRI.ArcGIS.Framework;
11 |
12 | namespace BrutileArcGIS.commands
13 | {
14 | [ProgId("AddWmscCommand")]
15 | public sealed class AddWmsCLayerCommand : BaseCommand
16 | {
17 | private IMap _map;
18 | private IApplication _application;
19 |
20 | public AddWmsCLayerCommand()
21 | {
22 | m_category = "BruTile";
23 | m_caption = "Add &WMS-C service...";
24 | m_message = "Add WMS-C Layer";
25 | m_toolTip = m_message;
26 | m_name = "AddWmsCLayer";
27 | m_bitmap = Resources.WMS_icon;
28 | }
29 |
30 | public override void OnCreate(object hook)
31 | {
32 | if (hook == null)
33 | return;
34 |
35 | _application = hook as IApplication;
36 |
37 | //Disable if it is not ArcMap
38 | if (hook is IMxApplication)
39 | m_enabled = true;
40 | else
41 | m_enabled = false;
42 |
43 | }
44 |
45 | public override bool Enabled
46 | {
47 | get
48 | {
49 | return true;
50 | }
51 | }
52 |
53 | public override void OnClick()
54 | {
55 | try
56 | {
57 | var mxdoc = (IMxDocument)_application.Document;
58 | _map = mxdoc.FocusMap;
59 |
60 |
61 | var addWmsCForm = new AddWmsCForm();
62 | var result = addWmsCForm.ShowDialog(new ArcMapWindow(_application));
63 |
64 | if (result == DialogResult.OK)
65 | {
66 | var tileSource = addWmsCForm.SelectedTileSource;
67 |
68 | IConfig configWmsC = new ConfigWmsC(tileSource);
69 | var brutileLayer = new BruTileLayer(_application,configWmsC)
70 | {
71 | Name = configWmsC.CreateTileSource().Schema.Name,
72 | Visible = true
73 | };
74 | _map.AddLayer(brutileLayer);
75 | }
76 | }
77 | catch (Exception ex)
78 | {
79 | MessageBox.Show(ex.ToString());
80 | }
81 | }
82 |
83 | }
84 | }
85 |
--------------------------------------------------------------------------------
/TrafficSpider/BruTile/Wms/AuthorityURL.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) BruTile developers team. All rights reserved. See License.txt in the project root for license information.
2 |
3 | using System.Xml;
4 | using System.Xml.Linq;
5 |
6 | namespace BruTile.Wms
7 | {
8 | public class AuthorityURL : XmlObject
9 | {
10 | private OnlineResource _onlineResourceField;
11 |
12 | public AuthorityURL()
13 | {
14 | }
15 |
16 | public AuthorityURL(XElement node, string @namespace)
17 | {
18 | var att = node.Attribute("name");
19 | if (att == null)
20 | throw WmsParsingException.AttributeNotFound("name");
21 |
22 | Name = att.Value;
23 |
24 | var element = node.Element(XName.Get("OnlineResource", @namespace));
25 | if (element != null)
26 | OnlineResource = new OnlineResource(element, @namespace);
27 | }
28 |
29 | public string Name { get; set; }
30 |
31 | public OnlineResource OnlineResource
32 | {
33 | get
34 | {
35 | if ((_onlineResourceField == null))
36 | {
37 | _onlineResourceField = new OnlineResource();
38 | }
39 | return _onlineResourceField;
40 | }
41 | set
42 | {
43 | _onlineResourceField = value;
44 | }
45 | }
46 |
47 | #region Overrides of XmlObject
48 |
49 | public override void ReadXml(XmlReader reader)
50 | {
51 | reader.MoveToContent();
52 | Name = reader.GetAttribute("name");
53 |
54 | var isEmptyElement = reader.IsEmptyElement;
55 | reader.ReadStartElement();
56 | if (!isEmptyElement)
57 | {
58 | OnlineResource.ReadXml(reader);
59 | reader.ReadEndElement();
60 | }
61 | }
62 |
63 | public override void WriteXml(XmlWriter writer)
64 | {
65 | writer.WriteAttributeString("name", Name);
66 | writer.WriteStartElement("OnlineResource", Namespace);
67 | OnlineResource.WriteXml(writer);
68 | writer.WriteEndElement();
69 | }
70 |
71 | public override XElement ToXElement(string @namespace)
72 | {
73 | return new XElement(XName.Get("AuthorityURL", @namespace),
74 | new XAttribute(XName.Get("name"), Name),
75 | OnlineResource.ToXElement(@namespace));
76 | }
77 |
78 | #endregion Overrides of XmlObject
79 | }
80 | }
--------------------------------------------------------------------------------
/TrafficSpider/app/lib/Transform.cs:
--------------------------------------------------------------------------------
1 | using System.Drawing;
2 |
3 | namespace BrutileArcGIS.Lib
4 | {
5 | public class Transform
6 | {
7 | float _resolution;
8 | PointF _center;
9 | float _width;
10 | float _height;
11 | BruTile.Extent _extent;
12 |
13 | public Transform(PointF center, float resolution, float width, float height)
14 | {
15 | _center = center;
16 | _resolution = resolution;
17 | _width = width;
18 | _height = height;
19 | UpdateExtent();
20 | }
21 |
22 | public float Resolution
23 | {
24 | set
25 | {
26 | _resolution = value;
27 | UpdateExtent();
28 | }
29 | get
30 | {
31 | return _resolution;
32 | }
33 | }
34 |
35 | public PointF Center
36 | {
37 | set
38 | {
39 | _center = value;
40 | UpdateExtent();
41 | }
42 | }
43 |
44 | public float Width
45 | {
46 | set
47 | {
48 | _width = value;
49 | UpdateExtent();
50 | }
51 | }
52 |
53 | public float Height
54 | {
55 | set
56 | {
57 | _height = value;
58 | UpdateExtent();
59 | }
60 | }
61 |
62 | public BruTile.Extent Extent
63 | {
64 | get { return _extent; }
65 | }
66 |
67 | public PointF WorldToMap(double x, double y)
68 | {
69 | return new PointF((float)(x - _extent.MinX) / _resolution, (float)(_extent.MaxY - y) / _resolution);
70 | }
71 |
72 | public PointF MapToWorld(double x, double y)
73 | {
74 | return new PointF((float)(_extent.MinX + x) * _resolution, (float)(_extent.MaxY - y) * _resolution);
75 | }
76 |
77 | public RectangleF WorldToMap(double x1, double y1, double x2, double y2)
78 | {
79 | var point1 = WorldToMap(x1, y1);
80 | var point2 = WorldToMap(x2, y2);
81 | return new RectangleF(point1.X, point2.Y, point2.X - point1.X, point1.Y - point2.Y);
82 | }
83 |
84 | private void UpdateExtent()
85 | {
86 | var spanX = _width * _resolution;
87 | var spanY = _height * _resolution;
88 | _extent = new BruTile.Extent(_center.X - spanX * 0.5f, _center.Y - spanY * 0.5f,
89 | _center.X + spanX * 0.5f, _center.Y + spanY * 0.5f);
90 | }
91 | }
92 | }
93 |
--------------------------------------------------------------------------------
/TrafficSpider/BruTile/TileIndex.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) BruTile developers team. All rights reserved. See License.txt in the project root for license information.
2 |
3 | using System;
4 | using System.Globalization;
5 |
6 | namespace BruTile
7 | {
8 | public struct TileIndex : IComparable
9 | {
10 | private readonly int _col;
11 | private readonly int _row;
12 | private readonly string _level;
13 |
14 | public int Col
15 | {
16 | get { return _col; }
17 | }
18 |
19 | public int Row
20 | {
21 | get { return _row; }
22 | }
23 |
24 | public string Level
25 | {
26 | get { return _level; }
27 | }
28 |
29 | public TileIndex(int col, int row, string level)
30 | {
31 | _col = col;
32 | _row = row;
33 | _level = level;
34 | }
35 |
36 | public int CompareTo(object obj)
37 | {
38 | if (!(obj is TileIndex))
39 | {
40 | throw new ArgumentException("object of type TileIndex was expected");
41 | }
42 | return CompareTo((TileIndex) obj);
43 | }
44 |
45 | public int CompareTo(TileIndex index)
46 | {
47 | if (_col < index._col) return -1;
48 | if (_col > index._col) return 1;
49 | if (_row < index._row) return -1;
50 | if (_row > index._row) return 1;
51 | return String.Compare(_level, index._level, StringComparison.Ordinal);
52 | }
53 |
54 | public override bool Equals(object obj)
55 | {
56 | if (!(obj is TileIndex))
57 | return false;
58 |
59 | return Equals((TileIndex) obj);
60 | }
61 |
62 | public bool Equals(TileIndex index)
63 | {
64 | return _col == index._col && _row == index._row && _level == index._level;
65 | }
66 |
67 | public override int GetHashCode()
68 | {
69 | return _col ^ _row ^ ((_level == null) ? 0 : _level.GetHashCode());
70 | }
71 |
72 | public static bool operator ==(TileIndex key1, TileIndex key2)
73 | {
74 | return Equals(key1, key2);
75 | }
76 |
77 | public static bool operator !=(TileIndex key1, TileIndex key2)
78 | {
79 | return !Equals(key1, key2);
80 | }
81 |
82 | public static bool operator <(TileIndex key1, TileIndex key2)
83 | {
84 | return (key1.CompareTo(key2) < 0);
85 | }
86 |
87 | public static bool operator >(TileIndex key1, TileIndex key2)
88 | {
89 | return (key1.CompareTo(key2) > 0);
90 | }
91 | }
92 | }
--------------------------------------------------------------------------------
/TrafficSpider/BruTile/Wmts/xsd/wmtsPayload_response.xsd:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 | wmtsPayload_response
10 |
11 | This XML Schema Document initially was intended to encode SOAP
12 | response for a WMTS GetTile request but in the future it might be used
13 | and part of a WMTS service (or even in any OWS service) that needs a
14 | binary encoding.
15 |
16 | WMTS is an OGC Standard.
17 | Copyright (c) 2009,2010 Open Geospatial Consortium.
18 | To obtain additional rights of use, visit http://www.opengeospatial.org/legal/.
19 |
20 |
21 |
24 |
25 |
27 |
30 |
31 |
32 |
33 |
34 |
35 |
36 | MIMEType format of the PayloadContent
37 | once base64 decodified.
38 |
39 |
40 |
41 |
42 |
43 |
44 | Binary content encoded in base64. It could be useful to
45 | enclose it in a CDATA element to avoid XML parsing.
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 | MIMEType format of the TextContent
58 |
59 |
60 |
61 |
62 |
63 | Text string like HTML, XHTML, XML or TXT. HTML and TXT data has
64 | to be enclosed in a CDATA element to avoid XML parsing.
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
--------------------------------------------------------------------------------
/TrafficSpider/BruTile/Web/ArcGisTileRequest.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) BruTile developers team. All rights reserved. See License.txt in the project root for license information.
2 |
3 | // This file was created by Tim Ebben (Geodan) 2009
4 |
5 | using System;
6 | using System.Collections.Generic;
7 | using System.Text;
8 | using System.Globalization;
9 |
10 | namespace BruTile.Web
11 | {
12 | public class ArcGisTileRequest : IRequest
13 | {
14 | readonly Uri _baseUrl;
15 | readonly Dictionary _customParameters;
16 | readonly string _format;
17 |
18 | public ArcGisTileRequest(Uri baseUrl, string format)
19 | : this(baseUrl, format, new Dictionary())
20 | {
21 | }
22 |
23 | public ArcGisTileRequest(Uri baseUrl, string format, Dictionary customParameters)
24 | {
25 | _baseUrl = baseUrl;
26 | _format = format;
27 | _customParameters = customParameters;
28 | }
29 |
30 | public Uri GetUri(TileInfo info)
31 | {
32 | var url = new StringBuilder();
33 |
34 | url.AppendFormat(CultureInfo.InvariantCulture, "{0}/{1}/{2}/{3}.{4}",
35 | _baseUrl, LevelToHex(info.Index.Level), RowToHex(info.Index.Row), ColumnToHex(info.Index.Col), _format);
36 | AppendCustomParameters(url);
37 | return new Uri(url.ToString());
38 | }
39 |
40 | private void AppendCustomParameters(StringBuilder url)
41 | {
42 | if (_customParameters != null && _customParameters.Count > 0)
43 | {
44 | bool first = true;
45 | foreach (string name in _customParameters.Keys)
46 | {
47 | string value = _customParameters[name];
48 | url.AppendFormat("{0}{1}={2}", first ? "?" : "&", name, value);
49 | first = false;
50 | }
51 | }
52 | }
53 |
54 | private static string LevelToHex(string zoomLevelId)
55 | {
56 | var zoom = int.Parse(zoomLevelId);
57 |
58 | string zoomUrl;
59 |
60 | if (zoom < 10)
61 | zoomUrl = "L0" + zoom;
62 | else
63 | zoomUrl = "L" + zoom;
64 |
65 | return zoomUrl;
66 | }
67 |
68 | static string ColumnToHex(int x)
69 | {
70 | return "C" + String.Format("{0:x8}", x); //Column (xTile naar hex met min/max 8 getallen aanvullen met 0)
71 | }
72 |
73 | static string RowToHex(int y)
74 | {
75 | return "R" + String.Format("{0:x8}", y); //Row (yTile naar hex met min/max 8 getallen aanvullen met 0)
76 | }
77 |
78 | }
79 | }
80 |
--------------------------------------------------------------------------------
/TrafficSpider/app/lib/SimpleFileFetcher.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using Amib.Threading;
5 | using BruTile;
6 | using BruTile.Cache;
7 |
8 | namespace BrutileArcGIS.lib
9 | {
10 | public class SimpleFileFetcher
11 | {
12 | private readonly ITileSource _tileSource;
13 | private readonly FileCache _fileCache;
14 | private const bool async = false;
15 |
16 | public SimpleFileFetcher(ITileSource tileSource, FileCache filecache)
17 | {
18 | if (tileSource == null) throw new ArgumentNullException("tileSource");
19 | if (filecache == null) throw new ArgumentNullException("filecache");
20 | _tileSource = tileSource;
21 | _fileCache = filecache;
22 | }
23 |
24 | public void Fetch(Extent newExtent, double newResolution)
25 | {
26 | var levelId = Utilities.GetNearestLevel(_tileSource.Schema.Resolutions, newResolution);
27 | var tilesWanted = GetTilesWanted(_tileSource.Schema, newExtent, levelId);
28 | var tilesMissing = GetTilesMissing(tilesWanted, _fileCache);
29 | var stp = new SmartThreadPool(1000, 5);
30 |
31 | foreach (var info in tilesMissing)
32 | {
33 | // for debugging
34 | if(!async)
35 | Fetch(info);
36 | else
37 | {
38 | stp.QueueWorkItem(GetTileOnThread, new object[] { info });
39 | }
40 | }
41 | }
42 |
43 | private void GetTileOnThread(object parameter)
44 | {
45 |
46 | var @params = (object[])parameter;
47 | var tileInfo = (TileInfo)@params[0];
48 |
49 | Fetch(tileInfo);
50 | }
51 |
52 |
53 | private void Fetch(TileInfo tileInfo)
54 | {
55 | try
56 | {
57 | var data = _tileSource.Provider.GetTile(tileInfo);
58 | _fileCache.Add(tileInfo.Index, data);
59 |
60 | _fileCache.AddWorldFile(tileInfo, _tileSource.Schema.GetTileHeight("0"), _tileSource.Schema.GetTileHeight("0"),
61 | _tileSource.Schema.Format);
62 | }
63 | catch (Exception)
64 | {
65 | }
66 | }
67 |
68 |
69 | public IList GetTilesWanted(ITileSchema schema, Extent extent, string levelId)
70 | {
71 | return schema.GetTilesInView(extent, (levelId)).ToList();
72 | }
73 |
74 | public IList GetTilesMissing(IEnumerable tilesWanted, FileCache fileCache)
75 | {
76 | return tilesWanted.Where(
77 | info => fileCache.Find(info.Index) == null).ToList();
78 | }
79 | }
80 | }
81 |
--------------------------------------------------------------------------------
/TrafficSpider/BruTile/Wmts/CrsIdentifier.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) BruTile developers team. All rights reserved. See License.txt in the project root for license information.
2 |
3 | using System;
4 |
5 | namespace BruTile.Wmts
6 | {
7 | ///
8 | /// An identifier for the crs
9 | ///
10 | public struct CrsIdentifier : IEquatable
11 | {
12 | private readonly string _authority;
13 | private readonly string _version;
14 | private readonly string _identifier;
15 |
16 | public static bool TryParse(string urn_ogc_def_crs, out CrsIdentifier crs)
17 | {
18 | var parts = urn_ogc_def_crs.Split(':');
19 | switch (parts.Length)
20 | {
21 | case 6:
22 | crs = new CrsIdentifier(parts[4], "", parts[5]);
23 | break;
24 | case 7:
25 | crs = new CrsIdentifier(parts[4], parts[5], parts[6]);
26 | break;
27 | default:
28 | crs = new CrsIdentifier();
29 | break;
30 | }
31 |
32 | return !string.IsNullOrEmpty(crs.Authority);
33 | }
34 |
35 | ///
36 | /// Initializes this coordinate system identifier
37 | ///
38 | /// The authority
39 | /// The version
40 | /// The identifier
41 | internal CrsIdentifier(string authority, string version, string identifier)
42 | {
43 | _authority = authority;
44 | _version = version;
45 | _identifier = identifier;
46 | }
47 |
48 | ///
49 | /// The authority
50 | ///
51 | public string Authority
52 | {
53 | get { return _authority; }
54 | }
55 |
56 | ///
57 | /// The identifier
58 | ///
59 | public string Identifier
60 | {
61 | get { return _identifier; }
62 | }
63 |
64 | ///
65 | /// The version
66 | ///
67 | public string Version
68 | {
69 | get { return _version; }
70 | }
71 |
72 | public override string ToString()
73 | {
74 | return string.Format("urn:ogc:def:crs:{0}:{1}:{2}", Authority, Version, Identifier);
75 | }
76 |
77 | public bool Equals(CrsIdentifier other)
78 | {
79 | if (Authority != other.Authority) return false;
80 | if (Version != other.Version) return false;
81 | if (Identifier != other.Identifier) return false;
82 | return true;
83 | }
84 | }
85 | }
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | #################
2 | ## Eclipse
3 | #################
4 |
5 | *.pydevproject
6 | .project
7 | .metadata
8 | bin/
9 | tmp/
10 | *.tmp
11 | *.bak
12 | *.swp
13 | *~.nib
14 | local.properties
15 | .classpath
16 | .settings/
17 | .loadpath
18 |
19 | # External tool builders
20 | .externalToolBuilders/
21 |
22 | # Locally stored "Eclipse launch configurations"
23 | *.launch
24 |
25 | # CDT-specific
26 | .cproject
27 |
28 | # PDT-specific
29 | .buildpath
30 |
31 |
32 | #################
33 | ## Visual Studio
34 | #################
35 |
36 | ## Ignore Visual Studio temporary files, build results, and
37 | ## files generated by popular Visual Studio add-ons.
38 |
39 | # User-specific files
40 | *.suo
41 | *.user
42 | *.sln.docstates
43 |
44 | # Build results
45 | [Dd]ebug/
46 | [Rr]elease/
47 | *_i.c
48 | *_p.c
49 | *.ilk
50 | *.meta
51 | *.obj
52 | *.pch
53 | *.pdb
54 | *.pgc
55 | *.pgd
56 | *.rsp
57 | *.sbr
58 | *.tlb
59 | *.tli
60 | *.tlh
61 | *.tmp
62 | *.vspscc
63 | .builds
64 | *.dotCover
65 |
66 | ## TODO: If you have NuGet Package Restore enabled, uncomment this
67 | #packages/
68 |
69 | # Visual C++ cache files
70 | ipch/
71 | *.aps
72 | *.ncb
73 | *.opensdf
74 | *.sdf
75 |
76 | # Visual Studio profiler
77 | *.psess
78 | *.vsp
79 |
80 | # ReSharper is a .NET coding add-in
81 | _ReSharper*
82 |
83 | # Installshield output folder
84 | [Ee]xpress
85 |
86 | # DocProject is a documentation generator add-in
87 | DocProject/buildhelp/
88 | DocProject/Help/*.HxT
89 | DocProject/Help/*.HxC
90 | DocProject/Help/*.hhc
91 | DocProject/Help/*.hhk
92 | DocProject/Help/*.hhp
93 | DocProject/Help/Html2
94 | DocProject/Help/html
95 |
96 | # Click-Once directory
97 | publish
98 |
99 | # Others
100 | [Bb]in
101 | [Oo]bj
102 | sql
103 | TestResults
104 | *.Cache
105 | ClientBin
106 | stylecop.*
107 | ~$*
108 | *.dbmdl
109 | Generated_Code #added for RIA/Silverlight projects
110 |
111 | # Backup & report files from converting an old project file to a newer
112 | # Visual Studio version. Backup files are not needed, because we have git ;-)
113 | _UpgradeReport_Files/
114 | Backup*/
115 | UpgradeLog*.XML
116 |
117 |
118 |
119 | ############
120 | ## Windows
121 | ############
122 |
123 | # Windows image file caches
124 | Thumbs.db
125 |
126 | # Folder config file
127 | Desktop.ini
128 |
129 |
130 | #############
131 | ## Python
132 | #############
133 |
134 | *.py[co]
135 |
136 | # Packages
137 | *.egg
138 | *.egg-info
139 | dist
140 | build
141 | eggs
142 | parts
143 | bin
144 | var
145 | sdist
146 | develop-eggs
147 | .installed.cfg
148 |
149 | # Installer logs
150 | pip-log.txt
151 |
152 | # Unit test / coverage reports
153 | .coverage
154 | .tox
155 |
156 | #Translations
157 | *.mo
158 |
159 | #Mr Developer
160 | .mr.developer.cfg
161 |
162 | # Mac crap
163 | .DS_Store
164 |
--------------------------------------------------------------------------------
/TrafficSpider/app/ArcBruTileInstaller.cs:
--------------------------------------------------------------------------------
1 | using System.ComponentModel;
2 | using System.Configuration.Install;
3 | using System;
4 | using BrutileArcGIS.Lib;
5 | using log4net;
6 | using log4net.Config;
7 | using System.IO;
8 | using System.Diagnostics;
9 |
10 |
11 | namespace BruTileArcGIS
12 | {
13 | [RunInstaller(true)]
14 | public partial class ArcBruTileInstaller : Installer
15 | {
16 | private static readonly ILog Logger = LogManager.GetLogger("ArcBruTileSystemLogger");
17 |
18 | public ArcBruTileInstaller()
19 | {
20 | InitializeComponent();
21 | }
22 |
23 | public override void Install(System.Collections.IDictionary stateSaver)
24 | {
25 | base.OnAfterInstall(stateSaver);
26 |
27 | var esriRegAsmFilename = Path.Combine(
28 | Environment.GetFolderPath(Environment.SpecialFolder.CommonProgramFiles),
29 | "ArcGIS\\bin\\ESRIRegAsm.exe");
30 | var esriRegAsm = new Process {StartInfo = {FileName = esriRegAsmFilename}};
31 | var cmd = string.Format("\"{0}\" /p:Desktop", GetType().Assembly.Location);
32 | esriRegAsm.StartInfo.Arguments = cmd;
33 | Logger.Debug("Register for ArcGIS 10: " + cmd);
34 |
35 | esriRegAsm.Start();
36 | Logger.Debug("Register for ArcGIS 10 finished.");
37 |
38 | }
39 |
40 | public override void Uninstall(System.Collections.IDictionary savedState)
41 | {
42 | base.OnBeforeUninstall(savedState);
43 | XmlConfigurator.Configure(new FileInfo(GetType().Assembly.Location + ".config"));
44 | Logger.Debug("Uninstall ArcBruTile");
45 | // Try to clean up stuff
46 | try
47 | {
48 | var cacheFolder = CacheSettings.GetCacheFolder();
49 | Logger.Debug("Trying to delete tile folder: " + cacheFolder );
50 | Directory.Delete(cacheFolder,true);
51 | Logger.Debug("Tile directory is deleted");
52 | }
53 | catch (Exception ex)
54 | {
55 | Logger.Debug("Delete folder failed, error: " + ex);
56 | }
57 |
58 | var esriRegAsmFilename = Path.Combine(
59 | Environment.GetFolderPath(Environment.SpecialFolder.CommonProgramFiles),
60 | "ArcGIS\\bin\\ESRIRegAsm.exe");
61 | var esriRegAsm = new Process {StartInfo = {FileName = esriRegAsmFilename}};
62 | var cmd=string.Format("\"{0}\" /p:Desktop /u", GetType().Assembly.Location);
63 | esriRegAsm.StartInfo.Arguments = cmd;
64 | Logger.Debug("Unregister for ArcGIS 10: " + cmd);
65 | esriRegAsm.Start();
66 | Logger.Debug("Unregister for ArcGIS 10 finished.");
67 | }
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/TrafficSpider/DownloadTiles/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Linq;
5 | using System.Windows.Forms;
6 | using ESRI.ArcGIS;
7 |
8 | namespace DownloadTiles
9 | {
10 | static class Program
11 | {
12 | ///
13 | /// 应用程序的主入口点。
14 | ///
15 | [STAThread]
16 | static int Main(string[] args)
17 | {
18 | //CreatePoint();
19 | try
20 | {
21 | RuntimeManager.BindLicense(ProductCode.EngineOrDesktop);
22 | DownloadTask downloadTask = new DownloadTask();
23 | DateTime time = Convert.ToDateTime(args[0]);
24 | string _extent = args[1];
25 | string basePath = args[2];
26 | string tileDir = args[3];
27 | string csv = args[4];
28 | downloadTask.DoMainTask(time,_extent,basePath,tileDir,csv);
29 | }
30 | catch (Exception ex)
31 | {
32 | LogManager.LogPath = AppDomain.CurrentDomain.BaseDirectory + "\\log\\";
33 | LogManager.WriteLog("error",ex.Message);
34 | return -1;
35 | }
36 | LogManager.LogPath = AppDomain.CurrentDomain.BaseDirectory + "\\log\\";
37 | LogManager.WriteLog("state","执行任务成功!");
38 | return 2;
39 | }
40 |
41 | public static void CreatePoint()
42 | {
43 | List point = new List();
44 | StreamReader sr3 = new StreamReader(@"D:\我的文件\项目\Data\TrafficLevel9\广州\temp\band3.txt");
45 | StreamReader sr4 = new StreamReader(@"D:\我的文件\项目\Data\TrafficLevel9\广州\temp\band4.txt");
46 | for (int i = 0; i < 3584; i++)
47 | {
48 | string[] line3 = sr3.ReadLine().Split(new char[] { ' ' });
49 | string[] line4 = sr4.ReadLine().Split(new char[] { ' ' });
50 | for (int j = 0; j < 3584; j++)
51 | {
52 | if (line4[j] != "0" && line3[j] == "0")
53 | {
54 | point.Add(new[] { j, i });
55 | j = j + 5;
56 | }
57 |
58 | }
59 | for (int k = 0; k < 2; k++)
60 | {
61 | sr3.ReadLine();
62 | sr4.ReadLine();
63 | i++;
64 | }
65 |
66 | }
67 | StreamWriter sr = new StreamWriter(@"D:\我的文件\项目\Data\TrafficLevel9\广州\temp\point.txt");
68 | foreach (int[] list in point)
69 | {
70 | sr.WriteLine("{0},{1}", list[0], list[1]);
71 | }
72 | sr.Dispose();
73 | }
74 | }
75 |
76 |
77 |
78 | }
79 |
--------------------------------------------------------------------------------
/TrafficSpider/BruTile/Wms/MetadataURL.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) BruTile developers team. All rights reserved. See License.txt in the project root for license information.
2 |
3 | using System.Xml;
4 | using System.Xml.Linq;
5 |
6 | namespace BruTile.Wms
7 | {
8 | public class MetadataURL : XmlObject
9 | {
10 | private OnlineResource _onlineResourceField;
11 |
12 | public MetadataURL()
13 | {
14 | }
15 |
16 | public MetadataURL(XElement node, string @namespace)
17 | {
18 | var att = node.Attribute("type");
19 | if (att == null)
20 | throw WmsParsingException.AttributeNotFound("type");
21 |
22 | Type = att.Value;
23 |
24 | var element = node.Element(XName.Get("Format", @namespace));
25 | Format = element == null ? "png" : element.Value;
26 |
27 | element = node.Element(XName.Get("OnlineResource", @namespace));
28 | if (element != null)
29 | OnlineResource = new OnlineResource(element, @namespace);
30 | }
31 |
32 | public override XElement ToXElement(string @namespace)
33 | {
34 | return new XElement(XName.Get("StyleURL", @namespace),
35 | new XAttribute(XName.Get("type"), Type),
36 | new XElement(XName.Get("Format", @namespace), Format),
37 | OnlineResource.ToXElement(@namespace));
38 | }
39 |
40 | public string Format { get; set; }
41 |
42 | public string Type { get; set; }
43 |
44 | public OnlineResource OnlineResource
45 | {
46 | get
47 | {
48 | if ((_onlineResourceField == null))
49 | {
50 | _onlineResourceField = new OnlineResource();
51 | }
52 | return _onlineResourceField;
53 | }
54 | set
55 | {
56 | _onlineResourceField = value;
57 | }
58 | }
59 |
60 | #region Overrides of XmlObject
61 |
62 | public override void ReadXml(XmlReader reader)
63 | {
64 | var isEmptyElement = reader.IsEmptyElement;
65 | reader.ReadStartElement();
66 | if (!isEmptyElement)
67 | {
68 | reader.ReadStartElement("Format");
69 | Format = reader.ReadContentAsString();
70 | reader.ReadEndElement();
71 | OnlineResource.ReadXml(reader);
72 | }
73 | }
74 |
75 | public override void WriteXml(XmlWriter writer)
76 | {
77 | writer.WriteElementString("Format", Format);
78 | writer.WriteStartElement("OnlineResource", Namespace);
79 | OnlineResource.WriteXml(writer);
80 | writer.WriteEndElement();
81 | }
82 |
83 | #endregion Overrides of XmlObject
84 | }
85 | }
--------------------------------------------------------------------------------
/TrafficSpider/BruTile/Wms/KeywordList.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) BruTile developers team. All rights reserved. See License.txt in the project root for license information.
2 |
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Xml;
6 | using System.Xml.Linq;
7 |
8 | namespace BruTile.Wms
9 | {
10 | public class KeywordList : XmlObject
11 | {
12 | private List _keywordField;
13 |
14 | public KeywordList()
15 | {
16 | }
17 |
18 | public KeywordList(XElement node, string @namespace)
19 | {
20 | foreach (var element in node.Elements(XName.Get("Keyword", @namespace)))
21 | {
22 | Keyword.Add(new Keyword(element, @namespace));
23 | }
24 | }
25 |
26 | public List Keyword
27 | {
28 | get
29 | {
30 | if (_keywordField == null)
31 | {
32 | _keywordField = new List();
33 | }
34 | return _keywordField;
35 | }
36 | set
37 | {
38 | _keywordField = value;
39 | }
40 | }
41 |
42 | #region Overrides of XmlObject
43 |
44 | public override void ReadXml(XmlReader reader)
45 | {
46 | Keyword.Clear();
47 |
48 | var subReader = reader.ReadSubtree();
49 |
50 | if (CheckEmptyNode(subReader, "KeywordList", string.Empty, true))
51 | return;
52 |
53 | while (!subReader.EOF)
54 | {
55 | subReader.MoveToContent();
56 | if (subReader.LocalName == "Keyword")
57 | {
58 | var att = subReader.GetAttribute("vocabulary");
59 | reader.ReadStartElement("Keyword");
60 | var val = reader.ReadContentAsString();
61 | reader.ReadEndElement();
62 | Keyword.Add(new Keyword { Vocabulary = att, Value = val });
63 | }
64 | else
65 | {
66 | subReader.ReadEndElement();
67 | }
68 | }
69 |
70 | reader.Skip();
71 | }
72 |
73 | public override void WriteXml(XmlWriter writer)
74 | {
75 | foreach (var keyword in Keyword)
76 | {
77 | writer.WriteStartElement("Keyword", Namespace);
78 | keyword.WriteXml(writer);
79 | writer.WriteEndElement();
80 | }
81 | }
82 |
83 | public override XElement ToXElement(string @namespace)
84 | {
85 | var elements = Keyword.Select(keyword => keyword.ToXElement(@namespace)).ToList();
86 | return new XElement(XName.Get("KeywordList", @namespace), elements);
87 | }
88 |
89 | #endregion Overrides of XmlObject
90 | }
91 | }
--------------------------------------------------------------------------------
/TrafficSpider/app/commands/AddServicesCommand.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 | using System.Windows.Forms;
4 | using BrutileArcGIS.forms;
5 | using BrutileArcGIS.Lib;
6 | using ESRI.ArcGIS.ADF.BaseClasses;
7 | using ESRI.ArcGIS.ArcMapUI;
8 | using ESRI.ArcGIS.Framework;
9 |
10 | namespace BrutileArcGIS.commands
11 | {
12 | [ProgId("AddServicesCommand")]
13 | public sealed class AddServicesCommand : BaseCommand
14 | {
15 | private IApplication _application;
16 |
17 | public AddServicesCommand()
18 | {
19 | m_category = "BruTile";
20 | m_caption = "&Add TMS service...";
21 | m_message = "Add TMS service...";
22 | m_toolTip = m_caption;
23 | m_name = "ServicesCommand";
24 | }
25 |
26 | public override void OnCreate(object hook)
27 | {
28 | if (hook == null)
29 | return;
30 |
31 | _application = hook as IApplication;
32 |
33 | //Disable if it is not ArcMap
34 | if (hook is IMxApplication)
35 | m_enabled = true;
36 | else
37 | m_enabled = false;
38 |
39 | }
40 |
41 | public override void OnClick()
42 | {
43 | try
44 | {
45 | var mxdoc = (IMxDocument)_application.Document;
46 | var map = mxdoc.FocusMap;
47 |
48 | var addServicesForm = new AddServicesForm();
49 |
50 | var result = addServicesForm.ShowDialog(new ArcMapWindow(_application));
51 | if (result == DialogResult.OK)
52 | {
53 | var selectedService = addServicesForm.SelectedService;
54 |
55 | // Fix the service labs.metacarta.com bug: it doubles the version :-(
56 | selectedService.Href = selectedService.Href.Replace(@"1.0.0/1.0.0", @"1.0.0").Trim();
57 |
58 |
59 | var layerType=EnumBruTileLayer.TMS;
60 |
61 | // If the type is inverted TMS we have to do something special
62 | if (selectedService.Type != null)
63 | {
64 | if (selectedService.Type == "InvertedTMS")
65 | {
66 | layerType = EnumBruTileLayer.InvertedTMS;
67 | }
68 | }
69 |
70 | var brutileLayer = new BruTileLayer(_application, layerType, selectedService.Href, selectedService.OverwriteUrls)
71 | {
72 | Name = selectedService.Title,
73 | Visible = true
74 | };
75 | map.AddLayer(brutileLayer);
76 | }
77 | }
78 | catch (Exception ex)
79 | {
80 | MessageBox.Show(ex.ToString());
81 | }
82 | }
83 | }
84 | }
85 |
--------------------------------------------------------------------------------
/TrafficSpider/DownloadTiles/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.0
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace DownloadTiles.Properties {
12 | using System;
13 |
14 |
15 | ///
16 | /// A strongly-typed resource class, for looking up localized strings, etc.
17 | ///
18 | // This class was auto-generated by the StronglyTypedResourceBuilder
19 | // class via a tool like ResGen or Visual Studio.
20 | // To add or remove a member, edit your .ResX file then rerun ResGen
21 | // with the /str option, or rebuild your VS project.
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources {
26 |
27 | private static global::System.Resources.ResourceManager resourceMan;
28 |
29 | private static global::System.Globalization.CultureInfo resourceCulture;
30 |
31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
32 | internal Resources() {
33 | }
34 |
35 | ///
36 | /// Returns the cached ResourceManager instance used by this class.
37 | ///
38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
39 | internal static global::System.Resources.ResourceManager ResourceManager {
40 | get {
41 | if (object.ReferenceEquals(resourceMan, null)) {
42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("DownloadTiles.Properties.Resources", typeof(Resources).Assembly);
43 | resourceMan = temp;
44 | }
45 | return resourceMan;
46 | }
47 | }
48 |
49 | ///
50 | /// Overrides the current thread's CurrentUICulture property for all
51 | /// resource lookups using this strongly typed resource class.
52 | ///
53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
54 | internal static global::System.Globalization.CultureInfo Culture {
55 | get {
56 | return resourceCulture;
57 | }
58 | set {
59 | resourceCulture = value;
60 | }
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/TrafficSpider/BruTile/Wmts/xsd/wmtsGetFeatureInfo_response.xsd:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 | wmtsGetFeatureInfo_response
11 |
12 | This XML Schema Document was intended to encode SOAP
13 | response for a WMTS GetFeatureInfo request but it can be used in other
14 | encoding. Since GetFeatureInfo response is completely open, it can not
15 | be more specific.
16 |
17 | WMTS is an OGC Standard.
18 | Copyright (c) 2009,2010 Open Geospatial Consortium.
19 | To obtain additional rights of use, visit http://www.opengeospatial.org/legal/.
20 |
21 |
22 |
25 |
26 |
27 |
28 |
31 |
32 |
33 |
34 |
35 |
36 |
37 | This allows to define any FeatureCollection that is a substitutionGroup
38 | of gml:_GML and use it here. A Geography Markup Language GML
39 | Simple Features Profile level 0 response format is strongly
40 | recommended as a FeatureInfo response.
41 |
42 |
43 |
44 |
45 |
46 |
47 | This allows to include any text format that is not a gml:_FeatureCollection
48 | like HTML, TXT, etc
49 |
50 |
51 |
52 |
53 |
54 |
55 | This allows to include any binary format. Binary formats are not
56 | common response for a GeFeatureInfo requests but possible for
57 | some imaginative implementations.
58 |
59 |
60 |
61 |
62 |
63 |
64 | This allows to include any XML content that it is not any of
65 | the previous ones.
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
--------------------------------------------------------------------------------