コード例 #1
0
ファイル: MainForm.cs プロジェクト: kanbang/Colt
 private static bool SupportsMutableMapProperties(RuntimeMap runtimeMap)
 {
     return runtimeMap.SupportsMutableBackgroundColor &&
            runtimeMap.SupportsMutableCoordinateSystem &&
            runtimeMap.SupportsMutableExtents &&
            runtimeMap.SupportsMutableMetersPerUnit;
 }
コード例 #2
0
ファイル: RuntimeMapGroup.cs プロジェクト: kanbang/Colt
        /// <summary>
        /// Initializes a new instance of the <see cref="RuntimeMapGroup"/> class.
        /// </summary>
        /// <param name="map">The map.</param>
        /// <param name="name">The name.</param>
        protected internal RuntimeMapGroup(RuntimeMap map, string name)
            : this()
        {
            this.Parent = map;
            this.Name = name;

            _disableChangeTracking = false;
        }
コード例 #3
0
ファイル: LegendPresenter.cs プロジェクト: kanbang/Colt
 public LegendControlPresenter(Legend legend, RuntimeMap map)
 {
     _legend = legend;
     _map = map;
     _provider = _map.CurrentConnection;
     _resSvc = _provider.ResourceService;
     InitInitialSelectabilityStates();
     _selectableIcon = Properties.Resources.lc_select;
     _unselectableIcon = Properties.Resources.lc_unselect;
 }
コード例 #4
0
ファイル: MapPreviewDialog.cs プロジェクト: kanbang/Colt
        public MapPreviewDialog(RuntimeMap map, IUrlLauncherService urlLauncher, string resourceId)
        {
            InitializeComponent();
            _map = map;
            if (!string.IsNullOrEmpty(resourceId))
                this.Text += " - " + resourceId;

            txtCoordinateSystem.Text = map.CoordinateSystem;
            numZoomToScale.Minimum = 1;
            numZoomToScale.Maximum = Int32.MaxValue;
            _launcher = urlLauncher;
            _conn = map.CurrentConnection;
            btnGetMapKml.Enabled = (_conn.ProviderName.ToUpper() == "MAESTRO.HTTP"); //NOXLATE
        }
コード例 #5
0
ファイル: RuntimeMapGroup.cs プロジェクト: kanbang/Colt
        /// <summary>
        /// Initializes a new instance of the <see cref="RuntimeMapGroup"/> class.
        /// </summary>
        /// <param name="map">The map.</param>
        /// <param name="group">The group.</param>
        protected internal RuntimeMapGroup(RuntimeMap map, IMapLayerGroup group)
            : this(map, group.Name)
        {
            _disableChangeTracking = true;

            this.Group = group.Group;
            this.ExpandInLegend = group.ExpandInLegend;
            this.LegendLabel = group.LegendLabel;
            this.ShowInLegend = group.ShowInLegend;
            this.Visible = group.Visible;

            this.Type = kNormal;

            _disableChangeTracking = false;
        }
コード例 #6
0
 /// <summary>
 /// Rebuilds the current Runtime Map
 /// </summary>
 public void RebuildRuntimeMap()
 {
     _rtMap = _mapSvc.CreateMap(_shadowCopy);
 }
コード例 #7
0
 /// <summary>
 /// Renders the runtime map.
 /// </summary>
 /// <param name="map">The runtime map instance.</param>
 /// <param name="x1">The x1.</param>
 /// <param name="y1">The y1.</param>
 /// <param name="x2">The x2.</param>
 /// <param name="y2">The y2.</param>
 /// <param name="width">The width.</param>
 /// <param name="height">The height.</param>
 /// <param name="dpi">The dpi.</param>
 /// <param name="format">The format.</param>
 /// <param name="clip">if set to <c>true</c> [clip].</param>
 /// <returns></returns>
 public abstract System.IO.Stream RenderRuntimeMap(RuntimeMap map, double x1, double y1, double x2, double y2, int width, int height, int dpi, string format, bool clip);
コード例 #8
0
 /// <summary>
 /// Renders the runtime map.
 /// </summary>
 /// <param name="map">The runtime map instance.</param>
 /// <param name="x">The x.</param>
 /// <param name="y">The y.</param>
 /// <param name="scale">The scale.</param>
 /// <param name="width">The width.</param>
 /// <param name="height">The height.</param>
 /// <param name="dpi">The dpi.</param>
 /// <param name="format">The format.</param>
 /// <returns></returns>
 public virtual System.IO.Stream RenderRuntimeMap(RuntimeMap map, double x, double y, double scale, int width, int height, int dpi, string format)
 {
     return this.RenderRuntimeMap(map, x, y, scale, width, height, dpi, format, false);
 }
コード例 #9
0
 /// <summary>
 /// Renders the runtime map.
 /// </summary>
 /// <param name="map">The runtime map instance.</param>
 /// <param name="x">The x.</param>
 /// <param name="y">The y.</param>
 /// <param name="scale">The scale.</param>
 /// <param name="width">The width.</param>
 /// <param name="height">The height.</param>
 /// <param name="dpi">The dpi.</param>
 /// <returns></returns>
 public virtual System.IO.Stream RenderRuntimeMap(RuntimeMap map, double x, double y, double scale, int width, int height, int dpi)
 {
     return this.RenderRuntimeMap(map, x, y, scale, width, height, dpi, "PNG", false); //NOXLATE
 }
コード例 #10
0
 /// <summary>
 /// Renders a dynamic overlay image of the map
 /// </summary>
 /// <param name="map"></param>
 /// <param name="selection"></param>
 /// <param name="format"></param>
 /// <param name="keepSelection"></param>
 /// <returns></returns>
 public abstract System.IO.Stream RenderDynamicOverlay(RuntimeMap map, MapSelection selection, string format, bool keepSelection);
コード例 #11
0
 /// <summary>
 /// Identifies those features that meet the specified spatial selection criteria. This operation is used to implement server-side selection. In addition to a selection set, this operation returns attribute information in case only one feature is selected. 
 /// </summary>
 /// <param name="rtMap">The runtime map to identify features</param>
 /// <param name="maxFeatures">The maximum number of features to return</param>
 /// <param name="wkt">The WKT of the filter geometry</param>
 /// <param name="persist">If true will update the selection set for the given map</param>
 /// <param name="selectionVariant">The type of spatial operator to use for the spatial query</param>
 /// <param name="extraOptions">Extra querying options</param>
 /// <returns></returns>
 public abstract string QueryMapFeatures(RuntimeMap rtMap, int maxFeatures, string wkt, bool persist, string selectionVariant, QueryMapOptions extraOptions);
コード例 #12
0
ファイル: RuntimeMapLayer.cs プロジェクト: kanbang/Colt
 /// <summary>
 /// Initializes a new instance of the <see cref="RuntimeMapLayer"/> class.
 /// </summary>
 /// <param name="parent">The parent.</param>
 /// <param name="ldf">The Layer Definition.</param>
 /// <param name="suppressErrors">If true, any errors while creating the layer are suppressed. The nature of the error may result in un-selectable layers</param>
 protected internal RuntimeMapLayer(RuntimeMap parent, ILayerDefinition ldf, bool suppressErrors)
     : this(parent)
 {
     _disableChangeTracking = true;
     Initialize(ldf, suppressErrors);
     _disableChangeTracking = false;
 }
コード例 #13
0
ファイル: RuntimeMapLayer.cs プロジェクト: kanbang/Colt
 /// <summary>
 /// Initializes this instance
 /// </summary>
 /// <param name="parent"></param>
 protected internal RuntimeMapLayer(RuntimeMap parent)
 {
     _scaleRanges = new double[] { 0.0, InfinityScale };
     _type = kDynamic;
     this.IdentityProperties = new PropertyInfo[0];
     _objectId = Guid.NewGuid().ToString();
     this.Parent = parent;
     _group = string.Empty;
 }
コード例 #14
0
ファイル: LocalNativeConnection.cs プロジェクト: kanbang/Colt
        public override System.IO.Stream RenderRuntimeMap(RuntimeMap rtmap, double x1, double y1, double x2, double y2, int width, int height, int dpi, string format, bool clip)
        {
            var resourceId = rtmap.ResourceID;
            MgRenderingService rnd = this.Connection.CreateService(MgServiceType.RenderingService) as MgRenderingService;
            MgResourceService res = this.Connection.CreateService(MgServiceType.ResourceService) as MgResourceService;
            MgGeometryFactory gf = new MgGeometryFactory();

            string mapname = new ResourceIdentifier(resourceId).Path;

            //TODO: The render is missing the clip param for the extent override method

            GetByteReaderMethod fetch = () =>
            {
                MgMap map = new MgMap();
                map.Open(res, mapname);
                MgSelection sel = new MgSelection(map);
                //The color accepted by MgColor has alpha as the last value, but the returned has alpha first
                MgColor color = new MgColor(Utility.ParseHTMLColor(map.GetBackgroundColor()));
                MgEnvelope env = new MgEnvelope(gf.CreateCoordinateXY(x1, y1), gf.CreateCoordinateXY(x2, y2));

                return rnd.RenderMap(map, sel, env, width, height, color, format);
            };
            LogMethodCall("MgRenderingService::RenderMap", true, "MgMap", "MgSelection", "MgEnvelope", width.ToString(), height.ToString(), "MgColor", format);
            return new MgReadOnlyStream(fetch);
        }
コード例 #15
0
ファイル: LocalNativeConnection.cs プロジェクト: kanbang/Colt
        public override System.IO.Stream RenderRuntimeMap(RuntimeMap rtmap, double x, double y, double scale, int width, int height, int dpi, string format, bool clip)
        {
            var resourceId = rtmap.ResourceID;
            MgRenderingService rnd = this.Connection.CreateService(MgServiceType.RenderingService) as MgRenderingService;
            MgResourceService res = this.Connection.CreateService(MgServiceType.ResourceService) as MgResourceService;
            MgGeometryFactory gf = new MgGeometryFactory();

            string mapname = new ResourceIdentifier(resourceId).Path;

            GetByteReaderMethod fetch = () =>
            {
                MgMap map = new MgMap();
                map.Open(res, mapname);
                MgSelection sel = new MgSelection(map);
                //The color accepted by MgColor has alpha as the last value, but the returned has alpha first
                MgColor color = new MgColor(Utility.ParseHTMLColor(map.GetBackgroundColor()));
                MgCoordinate coord = gf.CreateCoordinateXY(x, y);
                return rnd.RenderMap(map, sel, coord, scale, width, height, color, format, true);
            };
            LogMethodCall("MgRenderingService::RenderMap", true, "MgMap", "MgSelection", "MgPoint("+ x + "," + y + ")", scale.ToString(), width.ToString(), height.ToString(), "MgColor", format, true.ToString());
            return new MgReadOnlyStream(fetch);
        }
コード例 #16
0
ファイル: HttpServerConnection.cs プロジェクト: kanbang/Colt
        public override System.IO.Stream RenderRuntimeMap(RuntimeMap map, double x1, double y1, double x2, double y2, int width, int height, int dpi, string format, bool clip)
        {
            var resourceId = map.ResourceID;
            ResourceIdentifier.Validate(resourceId, ResourceTypes.RuntimeMap);
            string mapname = resourceId.Substring(resourceId.IndexOf("//") + 2);
            mapname = mapname.Substring(0, mapname.LastIndexOf("."));
            #if DEBUG
            string s = m_reqBuilder.GetMapImageUrl(mapname, format, null, x1, y1, x2, y2, dpi, width, height, clip, null, null, null, null);
            return new System.IO.MemoryStream(this.DownloadData(s));
            #else
            System.IO.MemoryStream ms = new System.IO.MemoryStream();
            System.Net.WebRequest req = m_reqBuilder.GetMapImage(mapname, format, null, x1, y1, x2, y2, dpi, width, height, clip, null, null, null, null, ms);

            //Maksim reported that the rendering times out frequently, so now we wait 5 minutes
            req.Timeout = 5 * 60 * 1000;

            using(System.IO.Stream rs = req.GetRequestStream())
            {
                Utility.CopyStream(ms, rs);
                rs.Flush();
                var resp = req.GetResponse();
                var hwr = resp as HttpWebResponse;

                if (hwr != null)
                    LogResponse(hwr);

                return resp.GetResponseStream();
            }

            #endif
        }
コード例 #17
0
ファイル: Legend.cs プロジェクト: kanbang/Colt
 void OnMapLoaded(object sender, EventArgs e)
 {
     _map = _viewer.GetMap();
     _presenter = new LegendControlPresenter(this, _map);
 }
コード例 #18
0
ファイル: RuntimeMapLayer.cs プロジェクト: kanbang/Colt
 /// <summary>
 /// Initializes a new instance of the <see cref="RuntimeMapLayer"/> class.
 /// </summary>
 /// <param name="parent">The parent.</param>
 /// <param name="source">The source.</param>
 /// <param name="suppressErrors"></param>
 protected internal RuntimeMapLayer(RuntimeMap parent, IMapLayer source, bool suppressErrors)
     : this(parent, source, (ILayerDefinition)parent.CurrentConnection.ResourceService.GetResource(source.ResourceId), suppressErrors)
 {
     _disableChangeTracking = false;
 }
コード例 #19
0
 /// <summary>
 /// Renders a dynamic overlay image of the map
 /// </summary>
 /// <param name="map"></param>
 /// <param name="selection"></param>
 /// <param name="format"></param>
 /// <returns></returns>
 public System.IO.Stream RenderDynamicOverlay(RuntimeMap map, MapSelection selection, string format)
 {
     return RenderDynamicOverlay(map, selection, format, true);
 }
コード例 #20
0
ファイル: RuntimeMapLayer.cs プロジェクト: kanbang/Colt
        /// <summary>
        /// Initializes a new instance
        /// </summary>
        /// <param name="parent"></param>
        /// <param name="source"></param>
        /// <param name="ldf"></param>
        /// <param name="suppressErrors"></param>
        protected internal RuntimeMapLayer(RuntimeMap parent, IMapLayer source, ILayerDefinition ldf, bool suppressErrors)
            : this(parent, (IBaseMapLayer)source, ldf, suppressErrors)
        {
            _disableChangeTracking = true;

            this.Group = source.Group;
            _visible = source.Visible;

            _disableChangeTracking = false;
        }
コード例 #21
0
 /// <summary>
 /// Renders a dynamic overlay image of the map
 /// </summary>
 /// <param name="map"></param>
 /// <param name="selection"></param>
 /// <param name="format"></param>
 /// <param name="selectionColor"></param>
 /// <param name="behaviour"></param>
 /// <returns></returns>
 public abstract System.IO.Stream RenderDynamicOverlay(RuntimeMap map, MapSelection selection, string format, Color selectionColor, int behaviour);
コード例 #22
0
ファイル: RuntimeMapLayer.cs プロジェクト: kanbang/Colt
 /// <summary>
 /// Initializes a new instance
 /// </summary>
 /// <param name="parent"></param>
 /// <param name="source"></param>
 /// <param name="ldf"></param>
 /// <param name="suppressErrors"></param>
 protected internal RuntimeMapLayer(RuntimeMap parent, IBaseMapLayer source, ILayerDefinition ldf, bool suppressErrors)
     : this(parent, ldf, suppressErrors)
 {
     Check.NotNull(source, "source"); //NOXLATE
     Check.NotNull(ldf, "ldf"); //NOXLATE
     Check.Precondition(source.ResourceId == ldf.ResourceID, "source.ResourceId == ldf.ResourceID"); //NOXLATE
 }
コード例 #23
0
 /// <summary>
 /// Renders the runtime map.
 /// </summary>
 /// <param name="map">The runtime map instance.</param>
 /// <param name="x1">The x1.</param>
 /// <param name="y1">The y1.</param>
 /// <param name="x2">The x2.</param>
 /// <param name="y2">The y2.</param>
 /// <param name="width">The width.</param>
 /// <param name="height">The height.</param>
 /// <param name="dpi">The dpi.</param>
 /// <returns></returns>
 public virtual System.IO.Stream RenderRuntimeMap(RuntimeMap map, double x1, double y1, double x2, double y2, int width, int height, int dpi)
 {
     return this.RenderRuntimeMap(map, x1, y1, x2, y2, width, height, dpi, "PNG", false); //NOXLATE
 }
コード例 #24
0
ファイル: HttpServerConnection.cs プロジェクト: kanbang/Colt
        public override string QueryMapFeatures(RuntimeMap map, int maxFeatures, string wkt, bool persist, string selectionVariant, QueryMapOptions extraOptions)
        {
            string runtimeMapName = map.Name;
            //The request may execeed the url limit of the server, when large geometries
            System.IO.MemoryStream ms = new System.IO.MemoryStream();
            System.Net.WebRequest req = m_reqBuilder.QueryMapFeatures(runtimeMapName, maxFeatures, wkt, persist, selectionVariant, extraOptions, ms);
            req.Timeout = 200 * 1000;
            ms.Position = 0;

            using (System.IO.Stream rs = req.GetRequestStream())
            {
                Utility.CopyStream(ms, rs);
                rs.Flush();
            }

            using (var sr = new StreamReader(req.GetResponse().GetResponseStream()))
                return sr.ReadToEnd();
        }
コード例 #25
0
 /// <summary>
 /// Renders the runtime map.
 /// </summary>
 /// <param name="map">The runtime map instance.</param>
 /// <param name="x1">The x1.</param>
 /// <param name="y1">The y1.</param>
 /// <param name="x2">The x2.</param>
 /// <param name="y2">The y2.</param>
 /// <param name="width">The width.</param>
 /// <param name="height">The height.</param>
 /// <param name="dpi">The dpi.</param>
 /// <param name="format">The format.</param>
 /// <returns></returns>
 public virtual System.IO.Stream RenderRuntimeMap(RuntimeMap map, double x1, double y1, double x2, double y2, int width, int height, int dpi, string format)
 {
     return this.RenderRuntimeMap(map, x1, y1, x2, y2, width, height, dpi, format, false);
 }
コード例 #26
0
ファイル: HttpServerConnection.cs プロジェクト: kanbang/Colt
        public override System.IO.Stream RenderDynamicOverlay(RuntimeMap map, MapSelection selection, string format, Color selectionColor, int behavior)
        {
            //This API was introduced in MGOS 2.1 so this won't work with older versions
            if (this.SiteVersion < new Version(2, 1, 0))
                throw new NotSupportedException();

            System.IO.MemoryStream ms = new System.IO.MemoryStream();
            var req = m_reqBuilder.GetDynamicMapOverlayImage(map.Name, (selection == null ? string.Empty : selection.ToXml()), format, selectionColor, behavior);

            return this.OpenRead(req);
        }
コード例 #27
0
        /// <summary>
        /// Binds the specified editor service to this editor
        /// </summary>
        /// <param name="service"></param>
        public override void Bind(IEditorService service)
        {
            this.EditorService = service;
            service.RegisterCustomNotifier(this);

            _shadowCopy = (IMapDefinition)service.GetEditedResource();
            _mapSvc = (IMappingService)_shadowCopy.CurrentConnection.GetService((int)ServiceType.Mapping);
            _rtMap = _mapSvc.CreateMap(_shadowCopy);
            repoView.Init(service.ResourceService, new ResourceTypes[] {
                ResourceTypes.LayerDefinition,
                ResourceTypes.FeatureSource
            }, new ResourceTypes[] {
                ResourceTypes.LayerDefinition,
                ResourceTypes.FeatureSource
            });

            ReloadViewer();
        }
コード例 #28
0
ファイル: HttpServerConnection.cs プロジェクト: kanbang/Colt
        public override System.IO.Stream RenderDynamicOverlay(RuntimeMap map, MapSelection selection, string format, bool keepSelection)
        {
            System.IO.MemoryStream ms = new System.IO.MemoryStream();
            System.Net.WebRequest req = m_reqBuilder.GetDynamicMapOverlayImage(map.Name, (selection == null ? string.Empty : selection.ToXml()), format, ms);

            //Maksim reported that the rendering times out frequently, so now we wait 5 minutes
            req.Timeout = 5 * 60 * 1000;

            using (System.IO.Stream rs = req.GetRequestStream())
            {
                Utility.CopyStream(ms, rs);
                rs.Flush();
                var resp = req.GetResponse();
                var hwr = resp as HttpWebResponse;
                if (hwr != null)
                    LogResponse(hwr);

                return resp.GetResponseStream();
            }
        }
コード例 #29
0
ファイル: NewGroupDialog.cs プロジェクト: kanbang/Colt
 public NewGroupDialog(RuntimeMap map)
 {
     InitializeComponent();
     _map = map;
 }
コード例 #30
0
ファイル: HttpServerConnection.cs プロジェクト: kanbang/Colt
        public Stream RenderMapLegend(RuntimeMap map, int width, int height, System.Drawing.Color backgroundColor, string format)
        {
            System.IO.MemoryStream ms = new System.IO.MemoryStream();
            string req = m_reqBuilder.RenderMapLegend(map.Name, width, height, ColorTranslator.ToHtml(backgroundColor), format);

            return this.OpenRead(req);
        }