コード例 #1
0
        /// <summary>
        /// Takes the users large AOI and breaks it down to smaller 1x1 degree AOI's to query all information in the larger one.  
        /// </summary>
        /// <param name="env">
        /// The envelope of the large AOI
        /// </param>
        /// <returns>
        /// Returns a list of polygons that are used to query GBD.
        /// </returns>
        public static List<GbdPolygon> CreateAois(IEnvelope env)
        {
            try
            {
                env.Project(Jarvis.ProjectedCoordinateSystem);
                List<GbdPolygon> polygons = new List<GbdPolygon>();
                IPoint startingPoint = env.UpperLeft;

                if (startingPoint.IsEmpty)
                {
                    return null;
                }
                while (startingPoint.Y != env.LowerLeft.Y)
                {
                    var temp = ProcessRow(new List<GbdPolygon>(), startingPoint, env);
                    polygons.AddRange(temp);

                    var newY = GetY(startingPoint, env);
                    startingPoint.Y = newY;
                }

                return polygons;
            }
            catch (Exception error)
            {
                return null;
            }
        }
コード例 #2
0
        public void DoSend(string locationSemantic, IEnvelope message, int timeout)
        {
            var timer = new Timer(timeout * 1000);
            m_location = locationSemantic;

            try
            {
                _is_completed = false;

                timer.Elapsed += Timer_Elasped;
                timer.Start();

                this.DoSend(locationSemantic, message);
                _is_completed = true;

                timer.Stop();
            }
            catch (Exception exception)
            {
                timer.Stop();
                throw;
            }
            finally
            {
                if (timer.Enabled)
                    timer.Stop();

                timer.Elapsed -= Timer_Elasped;
                timer.Dispose();
            }

        }
コード例 #3
0
 public QueryRasterLayer(IMapLayerInfo mapLayerInfo, IRaster raster)
 {
     this.Name = mapLayerInfo.Name;
     this.ID = mapLayerInfo.ID;
     this.Extent = mapLayerInfo.Extent;
     this.Raster = raster;
 }
コード例 #4
0
        public bool RetriveData(IEnvelope envelop, ref IList<IGeometry> outerData)
        {
            IEnvelope affected = envelop;
            var toUpdate = new List<ICache>();
            bool found = false;

            foreach (var cache in this.Caches)
            {
                var has = cache.RetriveData(affected, ref outerData, ref affected);

                if(!has)
                {
                    toUpdate.Add(cache);
                }
                else
                {
                    found = true;
                    break;
                }
            }

            if (found && toUpdate.Count > 0)
            {
                IEnumerable<IGeometry> cursor = outerData;
                toUpdate.ForEach(x => x.BuildCursor(cursor));

                var first = this.Caches.First();
                first.RetriveData(envelop, ref outerData, ref affected);
            }

            return true;
        }
コード例 #5
0
 public GetPersistentSubscriptionStats(IEnvelope envelope, string eventStreamId, string groupName)
 {
     Ensure.NotNull(envelope, "envelope");
     Envelope = envelope;
     _eventStreamId = eventStreamId;
     _groupName = groupName;
 }
コード例 #6
0
		/// <summary>
		/// Initializes a new instance of the ShapefileHeader class with values read in from the stream.
		/// </summary>
		/// <remarks>Reads the header information from the stream.</remarks>
		/// <param name="shpBinaryReader">BigEndianBinaryReader stream to the shapefile.</param>
		public ShapefileHeader(BigEndianBinaryReader shpBinaryReader)
		{
			if (shpBinaryReader == null)
				throw new ArgumentNullException("shpBinaryReader");

			_fileCode = shpBinaryReader.ReadInt32BE();	
			if (_fileCode != Shapefile.ShapefileId)
				throw new ShapefileException("The first four bytes of this file indicate this is not a shape file.");

			// skip 5 unsed bytes
			shpBinaryReader.ReadInt32BE();
			shpBinaryReader.ReadInt32BE();
			shpBinaryReader.ReadInt32BE();
			shpBinaryReader.ReadInt32BE();
			shpBinaryReader.ReadInt32BE();

			_fileLength = shpBinaryReader.ReadInt32BE();

			_version = shpBinaryReader.ReadInt32();
			Debug.Assert(_version == 1000, "Shapefile version", String.Format("Expecting only one version (1000), but got {0}",_version));
			int shapeType = shpBinaryReader.ReadInt32();
            _shapeType = (ShapeGeometryType) Enum.Parse(typeof(ShapeGeometryType), shapeType.ToString());

			//read in and store the bounding box
			double[] coords = new double[4];
			for (int i = 0; i < 4; i++)
				coords[i] = shpBinaryReader.ReadDouble();
			_bounds = new Envelope(coords[0], coords[2], coords[1], coords[3]);
			
			// skip z and m bounding boxes.
			for (int i = 0; i < 4; i++)
				shpBinaryReader.ReadDouble();	
		}
コード例 #7
0
		public SimplePointCursor(string filePath, IFields fields, int OID, 
			System.Array fieldMap, IEnvelope queryEnv, esriGeometryType geomType)	
		{
			//HIGHLIGHT: 0 - Set up cursor
			m_bIsFinished = false;
			m_pStreamReader = new System.IO.StreamReader(filePath);
			m_fields = fields;
			m_iOID = OID;
			m_fieldMap = fieldMap;
			m_searchEnv = queryEnv;
			switch (geomType)
			{
				case esriGeometryType.esriGeometryPolygon:
					m_wkGeom = new Polygon() as IGeometry;
					m_workPts = new PointClass[5];
					for (int i = 0; i < m_workPts.Length; i++)
						m_workPts[i] = new PointClass();
					break;
				case esriGeometryType.esriGeometryPolyline:
					m_wkGeom = new PolylineClass() as IGeometry;
					m_workPts = new PointClass[5];
					for (int i = 0; i < m_workPts.Length; i++)
						m_workPts[i] = new PointClass();
					break;
				
				case esriGeometryType.esriGeometryPoint:
					m_wkGeom = new PointClass() as IGeometry;
					break;
				default:	//doesn't need to set worker geometry if it is table 
					break;
			}

			//advance cursor so data is readily available
			this.NextRecord();
		}
コード例 #8
0
        public NetworkDataset(string configXML, IDataset osmDataset, string ndsName, IGPMessages messages, ITrackCancel trackCancel)
        {
            _xml = new NetworkDatasetXML(configXML, RESMGR);

            _osmDataset = osmDataset;
            _ndsName = ndsName;
            _messages = messages;
            _trackCancel = trackCancel;

            IDataElement deOSM = GPUtil.MakeDataElementFromNameObject(_osmDataset.FullName);
            _dsPath = deOSM.CatalogPath;

            _osmLineName = _osmDataset.Name + "_osm_ln";
            _osmLinePath = _dsPath + "\\" + _osmLineName;
            _osmPointName = _osmDataset.Name + "_osm_pt";
            _osmPointPath = _dsPath + "\\" + _osmPointName;

            // Get the extent from the point feature class
            // NOTE: the feature dataset is not used for this because exceptions occur (SDE only)
            //       if a feature class was recently deleted from the feature dataset.
            IFeatureClass fcPoint = ((IFeatureWorkspace)_osmDataset.Workspace).OpenFeatureClass(_osmPointName);
            IGeoDataset gds = (IGeoDataset)fcPoint;
            _extent = gds.Extent;
            _spatialReference = gds.SpatialReference;
        }
コード例 #9
0
ファイル: Quadtree.cs プロジェクト: ExRam/DotSpatial-PCL
 /// <summary>
 /// Ensure that the envelope for the inserted item has non-zero extents.
 /// Use the current minExtent to pad the envelope, if necessary.
 /// </summary>
 /// <param name="itemEnv"></param>
 /// <param name="minExtent"></param>
 public static IEnvelope EnsureExtent(IEnvelope itemEnv, double minExtent)
 {
     //The names "ensureExtent" and "minExtent" are misleading -- sounds like
     //this method ensures that the extents are greater than minExtent.
     //Perhaps we should rename them to "ensurePositiveExtent" and "defaultExtent".
     //[Jon Aquino]
     double minx = itemEnv.MinX;
     double maxx = itemEnv.MaxX;
     double miny = itemEnv.MinY;
     double maxy = itemEnv.MaxY;            
     // has a non-zero extent
     if (minx != maxx && miny != maxy) 
         return itemEnv;
     // pad one or both extents
     if (minx == maxx) 
     {
         minx = minx - minExtent / 2.0;
         maxx = minx + minExtent / 2.0;
     }
     if (miny == maxy) 
     {
         miny = miny - minExtent / 2.0;
         maxy = miny + minExtent / 2.0;
     }
     return new Envelope(minx, maxx, miny, maxy);
 }
コード例 #10
0
 public Delete(IEnvelope envelope, string name, bool deleteCheckpointStream, bool deleteStateStream)
 {
     _envelope = envelope;
     _name = name;
     _deleteCheckpointStream = deleteCheckpointStream;
     _deleteStateStream = deleteStateStream;
 }
コード例 #11
0
 //Why ask the renderer when you know already?
 public override IList GetFeatures(IEnvelope box, ILayer layer)
 {
     var coverage = ((NetworkCoverageSegmentLayer)layer).Coverage;
     var segments = coverage.Segments.Values
         .Where(networkLocation => networkLocation.Geometry.EnvelopeInternal.Intersects(box)).ToList();
     return segments;
 }
コード例 #12
0
ファイル: CurvePointTool.cs プロジェクト: lishxi/_SharpMap
        ///// <summary>
        ///// snapping specific for a tool. Called before layer specific snappping is applied.
        ///// </summary>
        ///// <param name="sourceLayer"></param>
        ///// <param name="snapSource"></param>
        ///// <param name="worldPos"></param>
        ///// <param name="Envelope"></param>
        ///// <returns></returns>
        public void Snap(ILayer sourceLayer, IGeometry snapSource, ICoordinate worldPos, IEnvelope Envelope)
        {
            SnapResult = null;
            IFeature sourceFeature = MapControl.SelectTool.FeatureEditors[0].SourceFeature;
            if (sourceFeature.Geometry != snapSource)
                return;
            SnapRole snapRole = SnapRole.FreeAtObject;
            if ((Control.ModifierKeys & Keys.Control) == Keys.Control)
                snapRole = SnapRole.Free;
            ISnapRule snapRule = new SnapRule
                                     {
                                         SourceLayer = sourceLayer,
                                         TargetLayer = sourceLayer,
                                         Obligatory = true,
                                         SnapRole = snapRole,
                                         PixelGravity = 4
                                     };

            SnapResult = MapControl.SnapTool.ExecuteSnapRule(
                                                snapRule,
                                                sourceFeature,
                                                sourceFeature.Geometry,
                                                new List<IFeature>
                                                    {
                                                        sourceFeature
                                                    },
                                                worldPos,
                                                -1);
        }
コード例 #13
0
ファイル: SqlLite.cs プロジェクト: lishxi/_SharpMap
        public System.Collections.ObjectModel.Collection<uint> GetObjectIDsInView(IEnvelope bbox)
        {
            Collection<uint> objectlist = new Collection<uint>();
            using (SQLiteConnection conn = new SQLiteConnection(_ConnectionString))
            {
                string strSQL = "SELECT " + this.ObjectIdColumn + " ";
                strSQL += "FROM " + this.Table + " WHERE ";

                strSQL += GetBoxClause(bbox);

                if (!String.IsNullOrEmpty(_defintionQuery))
                    strSQL += " AND " + this.DefinitionQuery + " AND ";

                using (SQLiteCommand command = new SQLiteCommand(strSQL, conn))
                {
                    conn.Open();
                    using (SQLiteDataReader dr = command.ExecuteReader())
                    {
                        while (dr.Read())
                        {
                            if (dr[0] != DBNull.Value)
                            {
                                uint ID = (uint)(int)dr[0];
                                objectlist.Add(ID);
                            }
                        }
                    }
                    conn.Close();
                }
            }
            return objectlist;
        }
コード例 #14
0
ファイル: Root.cs プロジェクト: zhongshuiyuan/mapwindowsix
 /// <summary> 
 /// Insert an item into the quadtree this is the root of.
 /// </summary>
 public virtual void Insert(IEnvelope itemEnv, object item)
 {
     int index = GetSubnodeIndex(itemEnv, origin);
     // if index is -1, itemEnv must cross the X or Y axis.
     if (index == -1) 
     {
         Add(item);
         return;
     }
     /*
     * the item must be contained in one quadrant, so insert it into the
     * tree for that quadrant (which may not yet exist)
     */
     Node node = Nodes[index];
     /*
     *  If the subquad doesn't exist or this item is not contained in it,
     *  have to expand the tree upward to contain the item.
     */
     if (node == null || ! node.Envelope.Contains(itemEnv)) 
     {
         Node largerNode = Node.CreateExpanded(node, itemEnv);
         Nodes[index] = largerNode;
     }
     /*
     * At this point we have a subquad which exists and must contain
     * contains the env for the item.  Insert the item into the tree.
     */
     InsertContained(Nodes[index], itemEnv, item);            
 }
コード例 #15
0
ファイル: boundingBox.cs プロジェクト: geopunt/geopunt4arcgis
        /// <summary> Class to handle a boundingbox, that make sure it is within Flanderers 
        /// and return string string in the wanted format from arcgis IEnvelope </summary>
        /// <param name="arcgisBbox">arcgis IEnvelope </param>
        public boundingBox(IEnvelope arcgisBbox)
        {
            //handle SRS
            inSRS = arcgisBbox.SpatialReference;

            //Set maxbounds
            Type factoryType = Type.GetTypeFromProgID("esriGeometry.SpatialReferenceEnvironment");
            System.Object obj = Activator.CreateInstance(factoryType);
            ISpatialReferenceFactory3 spatialReferenceFactory = obj as ISpatialReferenceFactory3;

            ISpatialReference lam72 = spatialReferenceFactory.CreateSpatialReference(31370);
            IEnvelope maxBounds = geopuntHelper.makeExtend(17750, 23720, 297240, 245340, lam72); //not outside flanders
            if (inSRS.FactoryCode != lam72.FactoryCode)
            {
                maxBounds = geopuntHelper.Transform(maxBounds as IGeometry, inSRS) as IEnvelope;
            }
            if (arcgisBbox.XMin > maxBounds.XMin) Xmin = arcgisBbox.XMin;
            else Xmin = maxBounds.XMin;
            if (arcgisBbox.YMin > maxBounds.YMin) Ymin = arcgisBbox.YMin;
            else Ymin = maxBounds.YMin;
            if (arcgisBbox.XMax < maxBounds.XMax) Xmax = arcgisBbox.XMax;
            else Xmax = maxBounds.XMax;
            if (arcgisBbox.YMax < maxBounds.YMax) Ymax = arcgisBbox.YMax;
            else Ymax = maxBounds.YMax;
        }
コード例 #16
0
ファイル: drawMapUnits.cs プロジェクト: chinasio/azgs-toolbar
 public static void DrawStratCorDiagram(IEnvelope Envelope)
 {
     double Text2BoxY = 0.2; //Y distance between the bottom of text and the next box
     double Text2BoxX = 0.1; //X distance between a box and the text that describes it
     double ColumnX = 0.1; //Space between columns
     DrawMapUnits(Envelope, false, ColumnX);
 }
コード例 #17
0
        private void Identify(IEnumerable<ILayer> layers, IEnvelope strict, IEnvelope tolerant)
        {
            foreach (IMapLayer layer in layers)
            {
                IGroup grp = layer as IGroup;
                if (grp != null)
                {
                    Identify(grp, strict, tolerant);
                }
                else
                {
                    IMapFeatureLayer gfl = layer as IMapFeatureLayer;
                    if (gfl != null)
                    {
                        if (gfl.DataSet.FeatureType == FeatureTypes.Polygon)
                        {
                            frmFeatureIdentifier.Add(gfl, strict);
                        }
                        else
                        {
                            frmFeatureIdentifier.Add(gfl, tolerant);
                        }
                    }
                }

            }
        }
コード例 #18
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="repository">The repository</param>
        /// <param name="fullExtent">Full Extent</param>
        /// <param name="featureClass">FeatureClass name</param>
        public InMemoryCache(IRepository repository, IEnvelope fullExtent, string featureClass)
        {
            this._repository = repository;
            this._featureName = featureClass;

            this.BuildGrid(fullExtent);
        }
コード例 #19
0
 /// <summary>
 /// Remove the row
 /// </summary>
 /// <param name="itemEnv"></param>
 /// <param name="item"></param>
 /// <returns></returns>
 public bool Remove(IEnvelope itemEnv, int item)
 {
     bool retValue = base.Remove(itemEnv, item);
     if (retValue)
         AdjustNodesForDeletedItem(Root, item);
     return retValue;
 }
コード例 #20
0
ファイル: SqlLite.cs プロジェクト: lishxi/_SharpMap
        public Collection<IGeometry> GetGeometriesInView(IEnvelope bbox, double minGeometrySize)
        {
            Collection<IGeometry> features = new Collection<IGeometry>();
            using (SQLiteConnection conn = new SQLiteConnection(_ConnectionString))
            {
                string BoxIntersect = GetBoxClause(bbox);

                string strSQL = "SELECT " + this.GeometryColumn + " AS Geom ";
                strSQL += "FROM " + this.Table + " WHERE ";
                strSQL += BoxIntersect;
                if (!String.IsNullOrEmpty(_defintionQuery))
                    strSQL += " AND " + this.DefinitionQuery;

                using (SQLiteCommand command = new SQLiteCommand(strSQL, conn))
                {
                    conn.Open();
                    using (SQLiteDataReader dr = command.ExecuteReader())
                    {
                        while (dr.Read())
                        {
                            if (dr[0] != DBNull.Value)
                            {
                                IGeometry geom = SharpMap.Converters.WellKnownText.GeometryFromWKT.Parse((string)dr[0]);
                                if (geom != null)
                                    features.Add(geom);
                            }
                        }
                    }
                    conn.Close();
                }
            }
            return features;
        }
コード例 #21
0
ファイル: MessageDispatcher.cs プロジェクト: Mecabot/RedDog
        public async Task Dispatch(string contentType, IEnvelope<IMessage> envelope, ISession session = null)
        {

            try
            {
                if (envelope.Body == null)
                    throw new MessageDispatcherException("The envelope did not contain a body. Unable to process message.");

                var bodyType = envelope.Body.GetType();

                // Get the handler types.
                if (!_handlerMap.HandlerTypes.ContainsKey(bodyType))
                {
                    throw new MessageDispatcherException("The message {0} has not been registered with a handler.", bodyType.Name);
                }

                // Execute handlers.
                foreach (var handlerType in _handlerMap.HandlerTypes[bodyType])
                {
                    // Log start.
                    MessengerEventSource.Log.MessageProcessing(bodyType, handlerType, envelope);

                    // Create the handler.
                    var handler = _container.Resolve(handlerType) as IMessageHandler;
                    if (handler == null)
                        throw new NullReferenceException("handler");

                    // Set envelope.
                    var envelopedHandler = handler as IEnvelopedHandler;
                    if (envelopedHandler != null)
                    {
                        envelopedHandler.Envelope = envelope;
                    }

                    // Set session.
                    var sessionHandler = handler as ISessionHandler;
                    if (sessionHandler != null)
                    {
                        sessionHandler.Session = session;
                    }

                    // Execute.
                    var startTime = DateTime.Now;
                    await ((handler as dynamic).Handle((dynamic)(envelope.Body)) as Task)
                        .ConfigureAwait(false);

                    // Log end.
                    MessengerEventSource.Log.MessageProcessed(bodyType, handlerType, (DateTime.Now - startTime).TotalSeconds, envelope);
                }
            }
            catch (Exception ex)
            {
                // Log.
                MessengerEventSource.Log.MessageProcessingException(contentType, envelope, ex);

                // Rethrow.
                throw;
            }
        }
コード例 #22
0
ファイル: Node.cs プロジェクト: zhongshuiyuan/mapwindowsix
 /// <summary>
 /// 
 /// </summary>
 /// <param name="env"></param>
 /// <param name="level"></param>
 public Node(IEnvelope env, int level)
 {
     this.env = env;
     this.level = level;
     centre = new Coordinate();
     centre.X = (env.Minimum.X + env.Maximum.X) / 2;
     centre.Y = (env.Minimum.Y + env.Maximum.Y) / 2;
 }
コード例 #23
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="envelope"></param>
 /// <returns></returns>
 public static IEnvelope GetEnvelopeExternal(IEnvelope envelope)
 {
     // Get envelope in external coordinates
     ICoordinate min = new Coordinate(envelope.MinX, envelope.MinY);
     ICoordinate max = new Coordinate(envelope.MaxX, envelope.MaxY);
     IEnvelope bounds = new Envelope(min.X, max.X, min.Y, max.Y);
     return bounds;
 }
コード例 #24
0
ファイル: Key.cs プロジェクト: DIVEROVIEDO/DotSpatial
 /// <summary>
 /// 
 /// </summary>
 /// <param name="env"></param>
 /// <returns></returns>
 public static int ComputeQuadLevel(IEnvelope env)
 {
     double dx = env.Width;
     double dy = env.Height;
     double dMax = dx > dy ? dx : dy;
     int level = DoubleBits.GetExponent(dMax) + 1;
     return level;
 }
コード例 #25
0
 public SendPipelineException(AbstractSendPipeline pipeline, AbstractPipelineComponent pipelineComponent, IEnvelope envelope, Exception exception)
     :base(string.Format(m_error_message, pipeline.Name, envelope.Header.InputChannel,  pipelineComponent.Name,  exception.ToString()))
 {
     Pipeline = pipeline;
     PipelineComponent = pipelineComponent;
     Envelope = envelope;
     Exception = exception;
 }
コード例 #26
0
ファイル: Node.cs プロジェクト: ExRam/DotSpatial-PCL
 /// <summary>
 ///
 /// </summary>
 /// <param name="env"></param>
 /// <param name="level"></param>
 public Node(IEnvelope env, int level)
 {
     _env = env;
     _level = level;
     _centre = new Coordinate();
     _centre.X = (env.Minimum.X + env.Maximum.X) / 2;
     _centre.Y = (env.Minimum.Y + env.Maximum.Y) / 2;
 }
コード例 #27
0
 /// <summary>
 /// Creates a new instance of GeoGraphics
 /// </summary>
 public GeoGraphics(Graphics inGraphics, IGeoMapFrame inMapFrame, Rectangle clipRectangle)
 {
     _chunk = inMapFrame.CurrentChunk;
     _device = inGraphics;
     //_envelope = inMapFrame.PixelToProj(clipRectangle);
     _envelope = inMapFrame.BufferToProj(clipRectangle);
     _mapFrame = inMapFrame;
 }
コード例 #28
0
 private static Message UnwrapPing(TcpPackage package, IEnvelope envelope)
 {
     var data = new byte[package.Data.Count];
     Buffer.BlockCopy(package.Data.Array, package.Data.Offset, data, 0, package.Data.Count);
     var pongMessage = new TcpMessage.PongMessage(package.CorrelationId, data);
     envelope.ReplyWith(pongMessage);
     return pongMessage;
 }
コード例 #29
0
 protected override IEnvelope AdjustBoundingBox(IEnvelope bbox, double scale, System.Drawing.Size size)
 {
     double[] points = m_transform.MathTransform.Transform(new double[] { bbox.MinX, bbox.MinY, bbox.MaxX, bbox.MaxY });
     IEnvelope localEnv = new Envelope(points[0], points[2], points[1], points[3]);
     localEnv = base.AdjustBoundingBox(localEnv, scale, size);
     points = m_transform.MathTransform.Inverse().Transform(new double[] { localEnv.MinX, localEnv.MinY, localEnv.MaxX, localEnv.MaxY });
     return new Envelope(points[0], points[2], points[1], points[3]);
 }
コード例 #30
0
 //Why ask the renderer when you know already?
 public override IList GetFeatures(IEnvelope box, ILayer layer)
 {
     return layer.DataSource.GetFeatures(box);
     /*var coverage = ((NetworkCoverageLocationLayer)layer).Coverage;
     var segments = coverage.Locations.Values
         .Where(networkLocation => networkLocation.Geometry.EnvelopeInternal.Intersects(box)).ToList();
     return segments;*/
 }
コード例 #31
0
        private ReplicationMessage.DataChunkBulk UnwrapDataChunkBulk(TcpPackage package, IEnvelope envelope)
        {
            var dto = package.Data.Deserialize <ReplicationMessageDto.DataChunkBulk>();

            return(new ReplicationMessage.DataChunkBulk(new Guid(dto.MasterId),
                                                        new Guid(dto.SubscriptionId),
                                                        dto.ChunkStartNumber,
                                                        dto.ChunkEndNumber,
                                                        dto.SubscriptionPosition,
                                                        dto.DataBytes,
                                                        dto.CompleteChunk));
        }
 public void OnNext(IEnvelope value) => Items.Push(value);
コード例 #33
0
ファイル: Program.cs プロジェクト: jugstalt/gview5
        static private Item ParseFeature(string metaId, string category, IFeature feature, Item proto, bool useGeometry, IGeometricTransformer transformer, ImportConfig.FeatureClassDefinition featureClassDef)
        {
            var replace = featureClassDef.Replacements;

            var result = new Item();

            string oid = feature.OID.ToString();

            if (feature.OID <= 0 && !String.IsNullOrWhiteSpace(featureClassDef.ObjectOidField))
            {
                var idFieldValue = feature.FindField(featureClassDef.ObjectOidField);
                if (idFieldValue != null)
                {
                    oid = idFieldValue.Value?.ToString();
                }
            }

            result.Id            = metaId + "." + oid;
            result.SuggestedText = ParseFeatureField(feature, proto.SuggestedText);
            result.SubText       = ParseFeatureField(feature, proto.SubText);
            result.ThumbnailUrl  = ParseFeatureField(feature, proto.ThumbnailUrl);
            result.Category      = category;

            if (replace != null)
            {
                foreach (var r in replace)
                {
                    result.SuggestedText = result.SuggestedText?.Replace(r.From, r.To);
                    result.SubText       = result.SubText?.Replace(r.From, r.To);
                }
            }

            if (useGeometry == true && feature.Shape != null)
            {
                IGeometry shape = feature.Shape;

                if (shape is IPoint)
                {
                    IPoint point = (IPoint)transformer.Transform2D(feature.Shape);
                    result.Geo = new Nest.GeoLocation(point.Y, point.X);
                }
                else if (shape is IPolyline)
                {
                    IEnvelope env = shape.Envelope;
                    if (env != null)
                    {
                        IPoint point = Algorithm.PolylinePoint((IPolyline)shape, ((IPolyline)shape).Length / 2.0);

                        if (point != null)
                        {
                            point      = (IPoint)transformer.Transform2D(point);
                            result.Geo = new Nest.GeoLocation(point.Y, point.X);
                        }

                        result.BBox = GetBBox(env, transformer);
                    }
                }
                else if (shape is IPolygon)
                {
                    IEnvelope env = shape.Envelope;
                    if (env != null)
                    {
                        var points = Algorithm.OrderPoints(Algorithm.PolygonLabelPoints((IPolygon)shape), env.Center);
                        if (points != null && points.PointCount > 0)
                        {
                            IPoint point = (IPoint)transformer.Transform2D(points[0]);
                            result.Geo = new Nest.GeoLocation(point.Y, point.X);
                        }

                        result.BBox = GetBBox(env, transformer);
                    }
                }
            }

            return(result);
        }
コード例 #34
0
        private void ProcessWrite <T>(IEnvelope envelope, Guid correlationId, string streamId, long expectedVersion,
                                      Event[] events, Func <int, int, T> writeEventsCompleted, T wrongExpectedVersionResponse,
                                      long[] positions = null, long?commitPosition = null) where T : Message
        {
            if (positions == null)
            {
                positions = new long[events.Length];
                for (int i = 0; i < positions.Length; i++)
                {
                    positions[i]   = _fakePosition;
                    _fakePosition += 100;
                }
            }

            List <EventRecord> list;

            if (!_streams.TryGetValue(streamId, out list) || list == null)
            {
                list = new List <EventRecord>();
                _streams[streamId] = list;
            }

            if (expectedVersion != EventStore.ClientAPI.ExpectedVersion.Any)
            {
                if (expectedVersion != list.Count - 1)
                {
                    envelope.ReplyWith(wrongExpectedVersionResponse);
                    return;
                }
            }

            var eventRecords = (from ep in events.Zip(positions, (@event, position) => new { @event, position })
                                let e = ep.@event
                                        let eventNumber = list.Count
                                                          //NOTE: ASSUMES STAYS ENUMERABLE
                                                          let tfPosition = ep.position
                                                                           select
                                                                           new {
                position = tfPosition,
                record =
                    new EventRecord(
                        eventNumber, tfPosition, correlationId, e.EventId, tfPosition, 0, streamId,
                        ExpectedVersion.Any, _timeProvider.UtcNow,
                        PrepareFlags.SingleWrite | (e.IsJson ? PrepareFlags.IsJson : PrepareFlags.None),
                        e.EventType, e.Data, e.Metadata)
            });                             //NOTE: DO NOT MAKE ARRAY

            foreach (var eventRecord in eventRecords)
            {
                list.Add(eventRecord.record);
                var tfPos = new TFPos(commitPosition ?? eventRecord.position + 50, eventRecord.position);
                _all.Add(tfPos, eventRecord.record);
                _bus.Publish(
                    new StorageMessage.EventCommitted(tfPos.CommitPosition, eventRecord.record, isTfEof: false));
            }

            _bus.Publish(new StorageMessage.TfEofAtNonCommitRecord());

            var firstEventNumber = list.Count - events.Length;

            if (envelope != null)
            {
                envelope.ReplyWith(writeEventsCompleted(firstEventNumber, firstEventNumber + events.Length - 1));
            }
        }
コード例 #35
0
 public Enable(IEnvelope envelope, string name, RunAs runAs)
     : base(envelope, runAs)
 {
     _name = name;
 }
コード例 #36
0
        /// <summary>
        /// 输出当前地图至指定的文件
        /// </summary>
        /// <param name="pView"></param>
        /// <param name="outPath"></param>
        public void ExportMapExtent(IActiveView pView, string outPath)
        {
            try
            {
                //参数检查
                if (pView == null)
                {
                    throw new Exception("输入参数错误,无法生成图片文件!");
                }
                //根据给定的文件扩展名,来决定生成不同类型的对象
                IExport export = null;
                if (outPath.EndsWith(".jpg"))
                {
                    export = new ExportJPEGClass();
                }
                else if (outPath.EndsWith(".tiff"))
                {
                    export = new ExportTIFFClass();
                }
                else if (outPath.EndsWith(".bmp"))
                {
                    export = new ExportBMPClass();
                }
                else if (outPath.EndsWith(".emf"))
                {
                    export = new ExportEMFClass();
                }
                else if (outPath.EndsWith(".png"))
                {
                    export = new ExportPNGClass();
                }
                else if (outPath.EndsWith(".gif"))
                {
                    export = new ExportGIFClass();
                }

                export.ExportFileName = outPath;
                IEnvelope pEnvelope = pView.Extent;

                //导出参数
                export.Resolution = 300;
                tagRECT exportRect = new tagRECT();
                exportRect.left = 0;
                exportRect.top  = 0;
                //这里暂时固定大小
                exportRect.right  = 700;
                exportRect.bottom = 1000;
                IEnvelope envelope = new EnvelopeClass();
                //输出范围
                envelope.PutCoords(exportRect.left, exportRect.bottom, exportRect.right, exportRect.top);
                export.PixelBounds = envelope;
                //可用于取消操作
                ITrackCancel pCancel = new CancelTrackerClass();
                export.TrackCancel = pCancel;
                pCancel.Reset();
                //点击ESC键时,中止转出
                pCancel.CancelOnKeyPress = true;
                pCancel.CancelOnClick    = false;
                pCancel.ProcessMessages  = true;
                //获取handle
                int hDC = export.StartExporting();
                //开始转出
                pView.Output(hDC, (int)export.Resolution, ref exportRect, pEnvelope, pCancel);
                bool bContinue = pCancel.Continue();
                //捕获是否继续
                if (bContinue)
                {
                    export.FinishExporting();
                    export.Cleanup();
                    MessageBox.Show("导出至" + outPath);
                }
                else
                {
                    export.Cleanup();
                }
                bContinue = pCancel.Continue();
            }
            catch (Exception excep)
            {
                MessageBox.Show("导出失败" + excep.Message);//错误信息提示
            }
        }
コード例 #37
0
 public PostBatch(
     IEnvelope envelope, RunAs runAs, ProjectionPost[] projections)
     : base(envelope, runAs)
 {
     Projections = projections;
 }
コード例 #38
0
        private ReplicationMessage.ReplicaLogPositionAck UnwrapReplicaLogPositionAck(TcpPackage package, IEnvelope envelope, TcpConnectionManager connection)
        {
            var dto = package.Data.Deserialize <ReplicationMessageDto.ReplicaLogPositionAck>();

            return(new ReplicationMessage.ReplicaLogPositionAck(new Guid(dto.SubscriptionId), dto.ReplicationLogPosition));
        }
コード例 #39
0
        public IEnumerable <IFeature> GetFeatures(IEnvelope bbox, string filter, double scale)
        {
            ScaleRange sr = null;

            foreach (ScaleRange sx in m_scaleRanges)
            {
                if (scale >= sx.Min && scale < sx.Max)
                {
                    sr = sx;
                    break;
                }
            }

            //Hack to test renderings speed in the test application
            if (sr == null && double.IsNaN(scale) && m_scaleRanges.Count > 0)
            {
                sr = m_scaleRanges[0];
            }

            if (sr == null)
            {
                return(new List <IFeature>());
            }

            if (m_featureCache == null)
            {
                VectorLayerDefinitionType vldef = m_layerDef.Item as VectorLayerDefinitionType;

                string        local_filter = ""; //TODO: Apply filter, from layer and passed in
                List <string> columns      = new List <string>(m_columnnames.Keys);

                List <IFeature> cache = new List <IFeature>();

                try
                {
                    using (FeatureSetReader fsr = m_layerDef.CurrentConnection.QueryFeatureSource(vldef.ResourceId, vldef.FeatureName, local_filter, columns.ToArray()))
                        while (fsr.Read())
                        {
                            IGeometry geom = fsr.Row[vldef.Geometry] as IGeometry;

                            if (geom == null)
                            {
                                continue;
                            }

                            //TODO: Evaluate rules and pick the correct one
                            if ((geom is IPoint || geom is IMultiPoint) && sr.PointRules.Count > 0)
                            {
                                cache.Add(new FeatureImpl(geom, sr.PointRules[0].Value));
                            }
                            else if ((geom is ILineString || geom is IMultiLineString) && sr.LineRules.Count > 0)
                            {
                                cache.Add(new FeatureImpl(geom, sr.LineRules[0].Value));
                            }
                            else if ((geom is IPolygon || geom is IMultiPolygon) && sr.AreaRules.Count > 0)
                            {
                                cache.Add(new FeatureImpl(geom, sr.AreaRules[0].Value));
                            }
                        }
                }
                catch
                {
                    cache = new List <IFeature>();
                }

                m_featureCache = cache;
            }

            return(m_featureCache);
        }
コード例 #40
0
 protected override double GetValue(IEnvelope envelope)
 {
     return(envelope.ZMax);
 }
コード例 #41
0
ファイル: frmKFunction.cs プロジェクト: sishui198/SAAR
        private void CalKhatWithEgde()
        {
            frmProgress pfrmProgress = new frmProgress();

            pfrmProgress.bgWorker.ReportProgress(0);
            pfrmProgress.lblStatus.Text = "Caculate Lhat";
            pfrmProgress.Show();

            m_dblBeginDist = Convert.ToDouble(nudBeginDist.Value);
            m_dblDistInc   = Convert.ToDouble(nudDistInc.Value);
            int intNDistBnd = Convert.ToInt32(nudNDistBands.Value);

            m_arrResultIdxs = new List <int> [intNDistBnd];
            for (int j = 0; j < intNDistBnd; j++)
            {
                m_arrResultIdxs[j] = new List <int>();
            }

            int intNFeatureCount = 0;

            IFeatureCursor pFCursor1 = m_pFClass.Search(null, false);

            intNFeatureCount = m_pFClass.FeatureCount(null);

            if (intNFeatureCount == 0)
            {
                return;
            }

            int intTotalFlowCnt = intNFeatureCount * (intNFeatureCount - 1);

            m_arrValue = new double[intTotalFlowCnt][];

            IFeature pFeature1 = pFCursor1.NextFeature();

            double[,] arrXYPts = new double[intNFeatureCount, 2];
            IPoint pPoint1;
            int    i = 0;

            while (pFeature1 != null)
            {
                pPoint1 = pFeature1.Shape as IPoint;

                arrXYPts[i, 0] = pPoint1.X;
                arrXYPts[i, 1] = pPoint1.Y;
                i++;
                pFeature1 = pFCursor1.NextFeature();
            }

            //For Edge Correction
            var watch = Stopwatch.StartNew();

            double[][] dblWeightCnt = EdgeCorrection(intNFeatureCount, intNDistBnd, m_pFeature, arrXYPts, m_dblDistInc, m_dblBeginDist);

            watch.Stop();
            double dblTime = watch.ElapsedMilliseconds;

            //For Edge Correction


            double[] arrResultCnt = new double[intNDistBnd];
            i = 0;
            for (int j = 0; j < intNFeatureCount; j++)
            {
                for (int k = 0; k < intNFeatureCount; k++)
                {
                    if (j != k)
                    {
                        int intProgress = i * 100 / intTotalFlowCnt;
                        pfrmProgress.bgWorker.ReportProgress(intProgress);

                        m_arrValue[i]    = new double[5];
                        m_arrValue[i][0] = arrXYPts[j, 0];
                        m_arrValue[i][1] = arrXYPts[j, 1];
                        m_arrValue[i][2] = arrXYPts[k, 0];
                        m_arrValue[i][3] = arrXYPts[k, 1];
                        m_arrValue[i][4] = Math.Sqrt(Math.Pow(arrXYPts[j, 0] - arrXYPts[k, 0], 2) + Math.Pow(arrXYPts[j, 1] - arrXYPts[k, 1], 2));

                        for (int l = 1; l <= intNDistBnd; l++)
                        {
                            double dblRefDist = l * m_dblDistInc + m_dblBeginDist;
                            if (m_arrValue[i][4] < dblRefDist)
                            {
                                m_arrResultIdxs[l - 1].Add(i);
                                arrResultCnt[l - 1] = arrResultCnt[l - 1] + dblWeightCnt[j][l - 1];
                            }
                        }
                        i++;
                    }
                }
            }

            pChart.Series.Clear();

            var pSeries = new System.Windows.Forms.DataVisualization.Charting.Series
            {
                Name              = "ObsLine",
                Color             = Color.Red,
                IsVisibleInLegend = false,
                ChartType         = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line,
            };

            pChart.Series.Add(pSeries);

            double dblConstant = m_dblArea / Math.Pow(intNFeatureCount, 2);

            for (int j = 0; j < intNDistBnd; j++)
            {
                double dblRefDist = (j + 1) * m_dblDistInc + m_dblBeginDist;
                //double dblDenorm = Math.PI * Math.Pow(dblRefDist, 2);

                double dblKhat = (arrResultCnt[j] * dblConstant); // Kfunction
                //pSeries.Points.AddXY(dblRefDist, dblKhat);

                double dblLhat = Math.Sqrt(dblKhat / Math.PI) - dblRefDist;
                pSeries.Points.AddXY(dblRefDist, dblLhat); //LFunction
            }
            m_intTotalNSeries = 1;



            //Permutation
            if (chkConfBnd.Checked)
            {
                pfrmProgress.bgWorker.ReportProgress(0);
                pfrmProgress.lblStatus.Text = "Caculate Confidence Bound";

                IEnvelope pEnv = m_pFLayer.AreaOfInterest;

                int intNPermutation = Convert.ToInt32(nudNPermutation.Value);
                double[,] arrConfBnds = new double[intNDistBnd, 2];
                for (int j = 0; j < intNDistBnd; j++)
                {
                    arrConfBnds[j, 0] = double.MinValue;
                    arrConfBnds[j, 1] = double.MaxValue;
                }

                for (int p = 0; p < intNPermutation; p++)
                {
                    int intProgress = p * 100 / intNPermutation;
                    pfrmProgress.bgWorker.ReportProgress(intProgress);

                    double[,] arrRndPts = RndPtswithStudyArea(intNFeatureCount, pEnv, m_pFeature);

                    //EdgeCorrection
                    double[][] dblPermWeightCnt = EdgeCorrection(intNFeatureCount, intNDistBnd, m_pFeature, arrRndPts, m_dblDistInc, m_dblBeginDist);

                    double[] arrPermCount = new double[intNDistBnd];
                    double   dblEstDist   = 0;

                    for (int j = 0; j < intNFeatureCount; j++)
                    {
                        for (int k = 0; k < intNFeatureCount; k++)
                        {
                            if (j != k)
                            {
                                dblEstDist = Math.Sqrt(Math.Pow(arrRndPts[j, 0] - arrRndPts[k, 0], 2) + Math.Pow(arrRndPts[j, 1] - arrRndPts[k, 1], 2));
                                for (int l = 1; l <= intNDistBnd; l++)
                                {
                                    double dblRefDist = l * m_dblDistInc + m_dblBeginDist;
                                    if (dblEstDist < dblRefDist)
                                    {
                                        arrPermCount[l - 1] = dblPermWeightCnt[j][l - 1] + arrPermCount[l - 1];
                                    }
                                }
                            }
                        }
                    }

                    for (int j = 0; j < intNDistBnd; j++)
                    {
                        double dblRefDist = (j + 1) * m_dblDistInc + m_dblBeginDist;
                        double dblKhat    = (arrPermCount[j] * dblConstant); // Kfunction
                        double dblLhat    = Math.Sqrt(dblKhat / Math.PI) - dblRefDist;

                        if (dblLhat > arrConfBnds[j, 0])
                        {
                            arrConfBnds[j, 0] = dblLhat;
                        }

                        if (dblLhat < arrConfBnds[j, 1])
                        {
                            arrConfBnds[j, 1] = dblLhat;
                        }
                    }
                }

                var pMaxSeries = new System.Windows.Forms.DataVisualization.Charting.Series
                {
                    Name              = "MaxLine",
                    Color             = Color.Gray,
                    IsVisibleInLegend = false,
                    ChartType         = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line,
                };
                pChart.Series.Add(pMaxSeries);

                var pMinSeries = new System.Windows.Forms.DataVisualization.Charting.Series
                {
                    Name              = "MinLine",
                    Color             = Color.Gray,
                    IsVisibleInLegend = false,
                    ChartType         = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line,
                };
                pChart.Series.Add(pMinSeries);

                for (int j = 0; j < intNDistBnd; j++)
                {
                    double dblRefDist = (j + 1) * m_dblDistInc + m_dblBeginDist;

                    pMaxSeries.Points.AddXY(dblRefDist, arrConfBnds[j, 0]);
                    pMinSeries.Points.AddXY(dblRefDist, arrConfBnds[j, 1]);
                }

                m_intTotalNSeries = 3;
            }

            pfrmProgress.Close();
        }
コード例 #42
0
ファイル: frmKFunction.cs プロジェクト: sishui198/SAAR
        private void CalKhatWithoutEgde()
        {
            m_dblBeginDist = Convert.ToDouble(nudBeginDist.Value);
            m_dblDistInc   = Convert.ToDouble(nudDistInc.Value);
            int intNDistBnd = Convert.ToInt32(nudNDistBands.Value);

            m_arrResultIdxs = new List <int> [intNDistBnd];
            for (int j = 0; j < intNDistBnd; j++)
            {
                m_arrResultIdxs[j] = new List <int>();
            }

            int intNFeatureCount = 0;

            IFeatureCursor pFCursor1 = m_pFClass.Search(null, false);

            intNFeatureCount = m_pFClass.FeatureCount(null);

            if (intNFeatureCount == 0)
            {
                return;
            }

            m_arrValue = new double[intNFeatureCount * (intNFeatureCount - 1)][];

            IFeature pFeature1 = pFCursor1.NextFeature();

            double[,] arrXYPts = new double[intNFeatureCount, 2];
            IPoint pPoint1;
            int    i = 0;

            while (pFeature1 != null)
            {
                pPoint1 = pFeature1.Shape as IPoint;

                arrXYPts[i, 0] = pPoint1.X;
                arrXYPts[i, 1] = pPoint1.Y;
                i++;
                pFeature1 = pFCursor1.NextFeature();
            }

            i = 0;
            for (int j = 0; j < intNFeatureCount; j++)
            {
                for (int k = 0; k < intNFeatureCount; k++)
                {
                    if (j != k)
                    {
                        m_arrValue[i]    = new double[5];
                        m_arrValue[i][0] = arrXYPts[j, 0];
                        m_arrValue[i][1] = arrXYPts[j, 1];
                        m_arrValue[i][2] = arrXYPts[k, 0];
                        m_arrValue[i][3] = arrXYPts[k, 1];
                        m_arrValue[i][4] = Math.Sqrt(Math.Pow(arrXYPts[j, 0] - arrXYPts[k, 0], 2) + Math.Pow(arrXYPts[j, 1] - arrXYPts[k, 1], 2));

                        for (int l = 1; l <= intNDistBnd; l++)
                        {
                            double dblRefDist = l * m_dblDistInc + m_dblBeginDist;
                            if (m_arrValue[i][4] < dblRefDist)
                            {
                                m_arrResultIdxs[l - 1].Add(i);
                            }
                        }
                        i++;
                    }
                }
            }

            #region previous method

            /* This method is too slow
             * //IFeature pFeature1 = pFCursor1.NextFeature();
             * ////IFeature pFeature2 = pFCursor2.NextFeature();
             *
             * //IFeatureCursor pFCursor2;
             * //IFeature pFeature2;
             * //IPoint pPoint1;
             * //IPoint pPoint2;
             *
             * //int i = 0;
             * //while (pFeature1 != null)
             * //{
             * //    pPoint1 = pFeature1.Shape as IPoint;
             * //    pFCursor2 = m_pFClass.Search(null, false);
             * //    pFeature2 = pFCursor2.NextFeature();
             *
             * //    while (pFeature2 != null)
             * //    {
             * //        if (pFeature1.OID != pFeature2.OID)
             * //        {
             * //            m_arrValue[i] = new double[5];
             * //            pPoint2 = pFeature2.Shape as IPoint;
             *
             * //            m_arrValue[i][0] = pPoint1.X;
             * //            m_arrValue[i][1] = pPoint1.Y;
             * //            m_arrValue[i][2] = pPoint2.X;
             * //            m_arrValue[i][3] = pPoint2.Y;
             * //            m_arrValue[i][4] = Math.Sqrt(Math.Pow(m_arrValue[i][0] - m_arrValue[i][2], 2) + Math.Pow(m_arrValue[i][1] - m_arrValue[i][3], 2));
             *
             * //            for (int k = 1; k <= intNDistBnd; k++)
             * //            {
             * //                double dblRefDist = k * dblDistInc + dblBeginDist;
             * //                if (m_arrValue[i][4] < dblRefDist)
             * //                    m_arrResultIdxs[k - 1].Add(i);
             * //            }
             * //            i++;
             * //        }
             * //        pFeature2 = pFCursor2.NextFeature();
             * //    }
             * //    pFCursor2.Flush();
             *
             * //    pFeature1 = pFCursor1.NextFeature();
             * //}
             */
            #endregion

            pChart.Series.Clear();

            var pSeries = new System.Windows.Forms.DataVisualization.Charting.Series
            {
                Name              = "ObsLine",
                Color             = Color.Red,
                IsVisibleInLegend = false,
                ChartType         = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line,
            };

            pChart.Series.Add(pSeries);

            double dblConstant = m_dblArea / Math.Pow(intNFeatureCount, 2);

            for (int j = 0; j < intNDistBnd; j++)
            {
                double dblRefDist = (j + 1) * m_dblDistInc + m_dblBeginDist;
                //double dblDenorm = Math.PI * Math.Pow(dblRefDist, 2);

                double dblKhat = (m_arrResultIdxs[j].Count * dblConstant); // Kfunction
                //pSeries.Points.AddXY(dblRefDist, dblKhat);

                double dblLhat = Math.Sqrt(dblKhat / Math.PI) - dblRefDist;
                pSeries.Points.AddXY(dblRefDist, dblLhat); //LFunction
            }
            m_intTotalNSeries = 1;



            //Permutation
            if (chkConfBnd.Checked)
            {
                IEnvelope pEnv = m_pFLayer.AreaOfInterest;

                int intNPermutation = Convert.ToInt32(nudNPermutation.Value);
                double[,] arrConfBnds = new double[intNDistBnd, 2];
                for (int j = 0; j < intNDistBnd; j++)
                {
                    arrConfBnds[j, 0] = double.MinValue;
                    arrConfBnds[j, 1] = double.MaxValue;
                }

                for (int p = 0; p < intNPermutation; p++)
                {
                    double[,] arrRndPts;
                    if (cboStudyArea.Text == "Minimum Enclosing Rectangle ")
                    {
                        arrRndPts = RndPtswithEnvelope(intNFeatureCount, pEnv);
                    }
                    else
                    {
                        arrRndPts = RndPtswithStudyArea(intNFeatureCount, pEnv, m_pFeature);
                    }

                    int[]  arrPermCount = new int[intNDistBnd];
                    double dblEstDist   = 0;

                    for (int j = 0; j < intNFeatureCount; j++)
                    {
                        for (int k = 0; k < intNFeatureCount; k++)
                        {
                            if (j != k)
                            {
                                dblEstDist = Math.Sqrt(Math.Pow(arrRndPts[j, 0] - arrRndPts[k, 0], 2) + Math.Pow(arrRndPts[j, 1] - arrRndPts[k, 1], 2));
                                for (int l = 1; l <= intNDistBnd; l++)
                                {
                                    double dblRefDist = l * m_dblDistInc + m_dblBeginDist;
                                    if (dblEstDist < dblRefDist)
                                    {
                                        arrPermCount[l - 1]++;
                                    }
                                }
                            }
                        }
                    }

                    for (int j = 0; j < intNDistBnd; j++)
                    {
                        double dblRefDist = (j + 1) * m_dblDistInc + m_dblBeginDist;
                        double dblKhat    = (arrPermCount[j] * dblConstant); // Kfunction
                        double dblLhat    = Math.Sqrt(dblKhat / Math.PI) - dblRefDist;

                        if (dblLhat > arrConfBnds[j, 0])
                        {
                            arrConfBnds[j, 0] = dblLhat;
                        }

                        if (dblLhat < arrConfBnds[j, 1])
                        {
                            arrConfBnds[j, 1] = dblLhat;
                        }
                    }
                }

                var pMaxSeries = new System.Windows.Forms.DataVisualization.Charting.Series
                {
                    Name              = "MaxLine",
                    Color             = Color.Gray,
                    IsVisibleInLegend = false,
                    ChartType         = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line,
                };
                pChart.Series.Add(pMaxSeries);

                var pMinSeries = new System.Windows.Forms.DataVisualization.Charting.Series
                {
                    Name              = "MinLine",
                    Color             = Color.Gray,
                    IsVisibleInLegend = false,
                    ChartType         = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line,
                };
                pChart.Series.Add(pMinSeries);

                for (int j = 0; j < intNDistBnd; j++)
                {
                    double dblRefDist = (j + 1) * m_dblDistInc + m_dblBeginDist;

                    pMaxSeries.Points.AddXY(dblRefDist, arrConfBnds[j, 0]);
                    pMinSeries.Points.AddXY(dblRefDist, arrConfBnds[j, 1]);
                }

                m_intTotalNSeries = 3;
            }
        }
コード例 #43
0
 public GetConfig(IEnvelope envelope, string name, RunAs runAs) :
     base(envelope, runAs)
 {
     _name = name;
 }
コード例 #44
0
 public Reset(IEnvelope envelope, string name, RunAs runAs)
     : base(envelope, runAs)
 {
     _name = name;
 }
コード例 #45
0
 protected override void BeginTileCore(BeginTileParameters parameters)
 {
     _tileEnvelope = parameters.TileEnvelope;
 }
コード例 #46
0
ファイル: ShapeHandler.cs プロジェクト: Sony-NS/SharpMap
 /// <summary>
 /// Get Envelope in external coordinates.
 /// </summary>
 /// <param name="precisionModel"></param>
 /// <param name="envelope"></param>
 /// <returns></returns>
 public static IEnvelope GetEnvelopeExternal(IPrecisionModel precisionModel, IEnvelope envelope)
 {
     return(GetEnvelopeExternal(envelope));
 }
コード例 #47
0
 public GetQuery(IEnvelope envelope, string name, RunAs runAs) :
     base(envelope, runAs)
 {
     _name = name;
 }
コード例 #48
0
        private static IPoint GetPosition(IPageLayout ipageLayout_0, out int int_0, out double double_0, out double double_1)
        {
            IPoint upperLeft;

            int_0    = 0;
            double_0 = 0;
            double_1 = 0;
            IPoint pointClass = new PointClass();

            pointClass.PutCoords(0, 0);
            try
            {
                XmlDocument xmlDocument = new XmlDocument();
                xmlDocument.LoadXml(ElementWizardHelp.m_Position);
                XmlNode itemOf = xmlDocument.ChildNodes[0];
                for (int i = 0; i < itemOf.ChildNodes.Count; i++)
                {
                    XmlNode xmlNodes = itemOf.ChildNodes[i];
                    string  value    = xmlNodes.Attributes["name"].Value;
                    string  str      = xmlNodes.Attributes["value"].Value;
                    string  str1     = value;
                    if (str1 != null)
                    {
                        if (str1 == "position")
                        {
                            int_0 = int.Parse(str);
                        }
                        else if (str1 == "xoffset")
                        {
                            double_0 = double.Parse(str);
                        }
                        else if (str1 == "yoffset")
                        {
                            double_1 = double.Parse(str);
                        }
                    }
                }
                IGraphicsContainer ipageLayout0  = ipageLayout_0 as IGraphicsContainer;
                IElement           element       = CommandFunction.FindElementByType(ipageLayout_0, "外框");
                IEnvelope          envelopeClass = null;
                if (element != null)
                {
                    envelopeClass = new EnvelopeClass();
                    element.QueryBounds((ipageLayout_0 as IActiveView).ScreenDisplay, envelopeClass);
                }
                if (envelopeClass == null)
                {
                    ipageLayout0.Reset();
                    IMapFrame mapFrame = ipageLayout0.FindFrame((ipageLayout_0 as IActiveView).FocusMap) as IMapFrame;
                    envelopeClass = (mapFrame as IElement).Geometry.Envelope;
                }
                ElementWizardHelp.m_posoitiontype = int_0;
                switch (int_0)
                {
                case 0:
                {
                    upperLeft = envelopeClass.UpperLeft;
                    pointClass.PutCoords(upperLeft.X + double_0, upperLeft.Y + double_1);
                    break;
                }

                case 1:
                {
                    upperLeft = new PointClass();
                    upperLeft.PutCoords((envelopeClass.XMin + envelopeClass.XMax) / 2, envelopeClass.YMax);
                    pointClass.PutCoords(upperLeft.X + double_0, upperLeft.Y + double_1);
                    break;
                }

                case 2:
                {
                    upperLeft = envelopeClass.UpperRight;
                    pointClass.PutCoords(upperLeft.X + double_0, upperLeft.Y + double_1);
                    break;
                }

                case 3:
                {
                    upperLeft = envelopeClass.UpperLeft;
                    pointClass.PutCoords(upperLeft.X + double_0, upperLeft.Y + double_1);
                    break;
                }

                case 4:
                {
                    upperLeft = envelopeClass.UpperRight;
                    pointClass.PutCoords(upperLeft.X + double_0, upperLeft.Y + double_1);
                    break;
                }

                case 5:
                {
                    upperLeft = new PointClass();
                    upperLeft.PutCoords(envelopeClass.XMin, (envelopeClass.YMin + envelopeClass.YMax) / 2);
                    pointClass.PutCoords(upperLeft.X + double_0, upperLeft.Y + double_1);
                    break;
                }

                case 6:
                {
                    upperLeft = new PointClass();
                    upperLeft.PutCoords(envelopeClass.XMax, (envelopeClass.YMin + envelopeClass.YMax) / 2);
                    pointClass.PutCoords(upperLeft.X + double_0, upperLeft.Y + double_1);
                    break;
                }

                case 7:
                {
                    upperLeft = envelopeClass.LowerLeft;
                    pointClass.PutCoords(upperLeft.X + double_0, upperLeft.Y + double_1);
                    break;
                }

                case 8:
                {
                    upperLeft = envelopeClass.LowerRight;
                    pointClass.PutCoords(upperLeft.X + double_0, upperLeft.Y + double_1);
                    break;
                }

                case 9:
                {
                    upperLeft = envelopeClass.LowerLeft;
                    pointClass.PutCoords(upperLeft.X + double_0, upperLeft.Y + double_1);
                    break;
                }

                case 10:
                {
                    upperLeft = new PointClass();
                    upperLeft.PutCoords((envelopeClass.XMin + envelopeClass.XMax) / 2, envelopeClass.YMin);
                    pointClass.PutCoords(upperLeft.X + double_0, upperLeft.Y + double_1);
                    break;
                }

                case 11:
                {
                    upperLeft = envelopeClass.LowerRight;
                    pointClass.PutCoords(upperLeft.X + double_0, upperLeft.Y + double_1);
                    break;
                }
                }
            }
            catch
            {
            }
            return(pointClass);
        }
コード例 #49
0
 public SetRunAs(IEnvelope envelope, string name, RunAs runAs, SetRemove action)
     : base(envelope, runAs)
 {
     _name   = name;
     _action = action;
 }
コード例 #50
0
        private ReplicationMessage.ReplicaSubscriptionRequest UnwrapReplicaSubscriptionRequest(TcpPackage package, IEnvelope envelope, TcpConnectionManager connection)
        {
            var dto = package.Data.Deserialize <ReplicationMessageDto.SubscribeReplica>();
            var vnodeTcpEndPoint = new IPEndPoint(new IPAddress(dto.Ip), dto.Port);
            var lastEpochs       = dto.LastEpochs.Safe().Select(x => new Epoch(x.EpochPosition, x.EpochNumber, new Guid(x.EpochId))).ToArray();

            return(new ReplicationMessage.ReplicaSubscriptionRequest(package.CorrelationId,
                                                                     envelope,
                                                                     connection,
                                                                     dto.LogPosition,
                                                                     new Guid(dto.ChunkId),
                                                                     lastEpochs,
                                                                     vnodeTcpEndPoint,
                                                                     new Guid(dto.MasterId),
                                                                     new Guid(dto.SubscriptionId),
                                                                     dto.IsPromotable));
        }
コード例 #51
0
 protected ControlMessage(IEnvelope envelope, RunAs runAs)
 {
     _envelope = envelope;
     RunAs     = runAs;
 }
コード例 #52
0
        private static StorageMessage.PrepareAck UnwrapPrepareAck(TcpPackage package, IEnvelope envelope)
        {
            var dto = package.Data.Deserialize <ReplicationMessageDto.PrepareAck>();

            return(new StorageMessage.PrepareAck(package.CorrelationId, dto.LogPosition, (PrepareFlags)dto.Flags));
        }
コード例 #53
0
        private ReplicationMessage.CloneAssignment UnwrapCloneAssignment(TcpPackage package, IEnvelope envelope)
        {
            var dto = package.Data.Deserialize <ReplicationMessageDto.CloneAssignment>();

            return(new ReplicationMessage.CloneAssignment(new Guid(dto.MasterId), new Guid(dto.SubscriptionId)));
        }
コード例 #54
0
        private ReplicationMessage.ReplicaSubscribed UnwrapReplicaSubscribed(TcpPackage package, IEnvelope envelope, TcpConnectionManager connection)
        {
            var dto = package.Data.Deserialize <ReplicationMessageDto.ReplicaSubscribed>();

            return(new ReplicationMessage.ReplicaSubscribed(new Guid(dto.MasterId),
                                                            new Guid(dto.SubscriptionId),
                                                            dto.SubscriptionPosition,
                                                            connection.RemoteEndPoint));
        }
コード例 #55
0
 public virtual ISnapStrategy Snap(ILayerEditor sourceEditorLayer, IGeometry snapSource, ICoordinate worldPos, IEnvelope Envelope)
 {
     return(null);
 }
コード例 #56
0
        private ReplicationMessage.ReplicaSubscriptionRetry UnwrapReplicaSubscriptionRetry(TcpPackage package, IEnvelope envelope)
        {
            var dto = package.Data.Deserialize <ReplicationMessageDto.ReplicaSubscriptionRetry>();

            return(new ReplicationMessage.ReplicaSubscriptionRetry(new Guid(dto.MasterId), new Guid(dto.SubscriptionId)));
        }
コード例 #57
0
ファイル: WMTSRequest.cs プロジェクト: jugstalt/gview5
        private void WmtsCapabilities100(IServiceRequestContext context, TileServiceMetadata metadata)
        {
            gView.Framework.OGC.WMTS.Version_1_0_0.Capabilities capabilities = new Framework.OGC.WMTS.Version_1_0_0.Capabilities()
            {
                version = "1.0.0"
            };

            capabilities.NameSpaces = new System.Xml.Serialization.XmlSerializerNamespaces();
            capabilities.NameSpaces.Add("ows", "http://www.opengis.net/ows/1.1");
            capabilities.NameSpaces.Add("xlink", "http://www.w3.org/1999/xlink");
            capabilities.NameSpaces.Add("gml", "http://www.opengis.net/gml");

            #region ServiceIndentification

            capabilities.ServiceIdentification       = new gView.Framework.OGC.WMTS.Version_1_0_0.ServiceIdentification();
            capabilities.ServiceIdentification.Title = new gView.Framework.OGC.WMTS.Version_1_0_0.LanguageStringType[] { new gView.Framework.OGC.WMTS.Version_1_0_0.LanguageStringType()
                                                                                                                         {
                                                                                                                             Value = CapabilitiesMapName(context) // do not add folder to the name => tilecache will not work with arcgis
                                                                                                                         } };
            capabilities.ServiceIdentification.ServiceType = new gView.Framework.OGC.WMTS.Version_1_0_0.CodeType()
            {
                Value = "OGC WMTS"
            };
            capabilities.ServiceIdentification.ServiceTypeVersion = new string[] { "1.0.0" };

            #endregion

            string restFulUrl;

            if (String.IsNullOrWhiteSpace(context.ServiceRequest.Folder))
            {
                restFulUrl = context.ServiceRequest.OnlineResource.ToLower()
                             .Replace("/ogc/" + context.ServiceRequest.Service, "/tilewmts/" + context.ServiceRequest.Service);
            }
            else
            {
                string fromServiceFullname = context.ServiceRequest.Folder + "@" + context.ServiceRequest.Service;
                string toServiceFullname   = context.ServiceRequest.Folder + "/" + context.ServiceRequest.Service;

                restFulUrl = context.ServiceRequest.OnlineResource.ToLower()
                             .Replace("/ogc/" + fromServiceFullname.ToLower(), "/tilewmts/" + toServiceFullname.ToLower());
            }

            #region OperationsMetadata

            capabilities.OperationsMetadata = new gView.Framework.OGC.WMTS.Version_1_0_0.OperationsMetadata();

            var getCapOperation = new gView.Framework.OGC.WMTS.Version_1_0_0.Operation()
            {
                name = "GetCapabilities"
            };
            getCapOperation.DCP               = new gView.Framework.OGC.WMTS.Version_1_0_0.DCP[] { new gView.Framework.OGC.WMTS.Version_1_0_0.DCP() };
            getCapOperation.DCP[0].Item       = new gView.Framework.OGC.WMTS.Version_1_0_0.HTTP();
            getCapOperation.DCP[0].Item.Items = new gView.Framework.OGC.WMTS.Version_1_0_0.RequestMethodType[] { new gView.Framework.OGC.WMTS.Version_1_0_0.RequestMethodType() };

            getCapOperation.DCP[0].Item.Items[0].href                        = context.ServiceRequest.OnlineResource + "?SERVICE=WMTS&VERSION=1.0.0" + "&";
            getCapOperation.DCP[0].Item.Items[0].Constraint                  = new gView.Framework.OGC.WMTS.Version_1_0_0.DomainType[] { new gView.Framework.OGC.WMTS.Version_1_0_0.DomainType() };
            getCapOperation.DCP[0].Item.Items[0].Constraint[0].name          = "GetEncoding";
            getCapOperation.DCP[0].Item.Items[0].Constraint[0].AllowedValues = new object[] { new gView.Framework.OGC.WMTS.Version_1_0_0.ValueType()
                                                                                              {
                                                                                                  Value = "KVP"                                                      /*"RESTful"*/
                                                                                              } };
            getCapOperation.DCP[0].Item.ItemsElementName = new gView.Framework.OGC.WMTS.Version_1_0_0.ItemsChoiceType[] { gView.Framework.OGC.WMTS.Version_1_0_0.ItemsChoiceType.Get };


            var getTileOperation = new gView.Framework.OGC.WMTS.Version_1_0_0.Operation()
            {
                name = "GetTile"
            };
            getTileOperation.DCP               = new gView.Framework.OGC.WMTS.Version_1_0_0.DCP[] { new gView.Framework.OGC.WMTS.Version_1_0_0.DCP() };
            getTileOperation.DCP[0].Item       = new gView.Framework.OGC.WMTS.Version_1_0_0.HTTP();
            getTileOperation.DCP[0].Item.Items = new gView.Framework.OGC.WMTS.Version_1_0_0.RequestMethodType[] { new gView.Framework.OGC.WMTS.Version_1_0_0.RequestMethodType() };

            getTileOperation.DCP[0].Item.Items[0].href                        = restFulUrl;
            getTileOperation.DCP[0].Item.Items[0].Constraint                  = new gView.Framework.OGC.WMTS.Version_1_0_0.DomainType[] { new gView.Framework.OGC.WMTS.Version_1_0_0.DomainType() };
            getTileOperation.DCP[0].Item.Items[0].Constraint[0].name          = "GetEncoding";
            getTileOperation.DCP[0].Item.Items[0].Constraint[0].AllowedValues = new object[] { new gView.Framework.OGC.WMTS.Version_1_0_0.ValueType()
                                                                                               {
                                                                                                   Value = "RESTful"
                                                                                               } };
            getTileOperation.DCP[0].Item.ItemsElementName = new gView.Framework.OGC.WMTS.Version_1_0_0.ItemsChoiceType[] { gView.Framework.OGC.WMTS.Version_1_0_0.ItemsChoiceType.Get };

            capabilities.OperationsMetadata.Operation = new gView.Framework.OGC.WMTS.Version_1_0_0.Operation[]
            {
                getCapOperation, getTileOperation
            };

            #endregion

            #region Contents

            capabilities.Contents = new gView.Framework.OGC.WMTS.Version_1_0_0.ContentsType();

            List <gView.Framework.OGC.WMTS.Version_1_0_0.LayerType>     layers     = new List <gView.Framework.OGC.WMTS.Version_1_0_0.LayerType>();
            List <gView.Framework.OGC.WMTS.Version_1_0_0.TileMatrixSet> matrixSets = new List <gView.Framework.OGC.WMTS.Version_1_0_0.TileMatrixSet>();

            ISpatialReference sRef4326 = SpatialReference.FromID("epsg:4326");

            foreach (var epsg in metadata.EPSGCodes)
            {
                IEnvelope extent = metadata.GetEPSGEnvelope(epsg);
                if (extent == null)
                {
                    Console.WriteLine($"EPSG { epsg }: Envelope not exits");
                    continue;
                }

                IPoint origin = metadata.GetOriginUpperLeft(epsg);
                if (origin == null)
                {
                    Console.WriteLine($"EPSG { epsg }: Origin not exits");
                    continue;
                }

                ISpatialReference sRef       = SpatialReference.FromID("epsg:" + epsg);
                IEnvelope         extent4326 = GeometricTransformerFactory.Transform2D(extent, sRef, sRef4326).Envelope;

                if (double.IsInfinity(extent4326.minx))
                {
                    extent4326.minx = -180D;
                }

                if (double.IsInfinity(extent4326.miny))
                {
                    extent4326.miny = -90D;
                }

                if (double.IsInfinity(extent4326.maxx))
                {
                    extent4326.maxx = 180D;
                }

                if (double.IsInfinity(extent4326.maxy))
                {
                    extent4326.maxy = 90D;
                }

                foreach (string cacheType in new string[] { "classic", "compact" })
                {
                    string epsgPath = _mapServer.TileCachePath + @"/" + MapName(context) + @"/_alllayers/" + (cacheType == "compact" ? @"compact/" : "") +
                                      TileServiceMetadata.EpsgPath(GridOrientation.UpperLeft, epsg);

                    if (!new DirectoryInfo(epsgPath).Exists)
                    {
                        Console.WriteLine($"Path { epsgPath }: not exists");
                        continue;
                    }

                    #region Layer

                    string layerName = /*Capabilities*/ MapName(context) + " EPSG:" + epsg + " " + cacheType;
                    string layerId   = /*Capabilities*/ MapName(context).ToLower().Replace(" ", "_") + "_" + epsg + "_" + cacheType;

                    var layer = new gView.Framework.OGC.WMTS.Version_1_0_0.LayerType();

                    layer.Title = new gView.Framework.OGC.WMTS.Version_1_0_0.LanguageStringType[] { new gView.Framework.OGC.WMTS.Version_1_0_0.LanguageStringType()
                                                                                                    {
                                                                                                        Value = layerName
                                                                                                    } };
                    layer.Identifier = new gView.Framework.OGC.WMTS.Version_1_0_0.CodeType()
                    {
                        Value = layerId
                    };

                    List <gView.Framework.OGC.WMTS.Version_1_0_0.Style> styles = new List <Framework.OGC.WMTS.Version_1_0_0.Style>();
                    //styles.Add(new gView.Framework.OGC.WMTS.Version_1_0_0.Style()
                    //{
                    //    Title = new gView.Framework.OGC.WMTS.Version_1_0_0.LanguageStringType[] { new gView.Framework.OGC.WMTS.Version_1_0_0.LanguageStringType() { Value = "Default Style" } },
                    //    Identifier = new gView.Framework.OGC.WMTS.Version_1_0_0.CodeType() { Value = "default" }
                    //});
                    foreach (FilterImplementations styleVal in Enum.GetValues(typeof(FilterImplementations)))
                    {
                        string name = Enum.GetName(typeof(FilterImplementations), styleVal);
                        styles.Add(new Framework.OGC.WMTS.Version_1_0_0.Style()
                        {
                            isDefault = styleVal == FilterImplementations.Default,
                            Title     = new gView.Framework.OGC.WMTS.Version_1_0_0.LanguageStringType[] { new gView.Framework.OGC.WMTS.Version_1_0_0.LanguageStringType()
                                                                                                          {
                                                                                                              Value = name
                                                                                                          } },
                            Identifier = new gView.Framework.OGC.WMTS.Version_1_0_0.CodeType()
                            {
                                Value = name.ToLower()
                            }
                        });
                    }

                    layer.Style = styles.ToArray();

                    #region BoundingBox

                    layer.BoundingBox = new gView.Framework.OGC.WMTS.Version_1_0_0.BoundingBoxType[]
                    {
                        new gView.Framework.OGC.WMTS.Version_1_0_0.BoundingBoxType()
                        {
                            crs         = "urn:ogc:def:crs:EPSG::" + epsg,
                            LowerCorner = PointToString(extent.LowerLeft, sRef),
                            UpperCorner = PointToString(extent.UpperRight, sRef)
                        }
                    };
                    layer.WGS84BoundingBox = new gView.Framework.OGC.WMTS.Version_1_0_0.WGS84BoundingBoxType[]
                    {
                        new gView.Framework.OGC.WMTS.Version_1_0_0.WGS84BoundingBoxType()
                        {
                            crs         = "urn:ogc:def:crs:OGC:2:84", // urn:ogc:def:crs:OGC:2:84
                            LowerCorner = PointToString(extent4326.LowerLeft, /*sRef4326*/ null),
                            UpperCorner = PointToString(extent4326.UpperRight, /*sRef4326*/ null)
                        }
                    };

                    #endregion

                    layer.TileMatrixSetLink = new gView.Framework.OGC.WMTS.Version_1_0_0.TileMatrixSetLink[]
                    {
                        new gView.Framework.OGC.WMTS.Version_1_0_0.TileMatrixSetLink()
                        {
                            TileMatrixSet = layerId + "_default_matrixset"
                        }
                    };

                    List <string> formats = new List <string>();
                    if (metadata.FormatJpg)
                    {
                        formats.Add("image/jpg");
                    }

                    if (metadata.FormatPng)
                    {
                        formats.Add("image/png");
                    }

                    layer.Format = formats.ToArray();

                    List <Framework.OGC.WMTS.Version_1_0_0.URLTemplateType> resourceURLs = new List <Framework.OGC.WMTS.Version_1_0_0.URLTemplateType>();
                    if (metadata.FormatJpg)
                    {
                        resourceURLs.Add(new Framework.OGC.WMTS.Version_1_0_0.URLTemplateType()
                        {
                            resourceType = Framework.OGC.WMTS.Version_1_0_0.URLTemplateTypeResourceType.tile,
                            format       = "image/jpg",
                            template     = restFulUrl + "/" + cacheType + "/ul/" + epsg + "/{Style}/{TileMatrix}/{TileRow}/{TileCol}.jpg"
                        });
                    }
                    if (metadata.FormatPng)
                    {
                        resourceURLs.Add(new Framework.OGC.WMTS.Version_1_0_0.URLTemplateType()
                        {
                            resourceType = Framework.OGC.WMTS.Version_1_0_0.URLTemplateTypeResourceType.tile,
                            format       = "image/png",
                            template     = restFulUrl + "/" + cacheType + "/ul/" + epsg + "/{Style}/{TileMatrix}/{TileRow}/{TileCol}.png"
                        });
                    }
                    layer.ResourceURL = resourceURLs.ToArray();

                    layers.Add(layer);

                    #endregion

                    #region Matrix Set

                    double matrixSetWidth  = Math.Abs(extent.maxx - origin.X); // extent.Width;
                    double matrixSetHeight = Math.Abs(origin.Y - extent.miny); // extent.Height;

                    var matrixSet = new gView.Framework.OGC.WMTS.Version_1_0_0.TileMatrixSet();

                    matrixSet.Title = new gView.Framework.OGC.WMTS.Version_1_0_0.LanguageStringType[] { new gView.Framework.OGC.WMTS.Version_1_0_0.LanguageStringType()
                                                                                                        {
                                                                                                            Value = layerName + " Default Matrix Set"
                                                                                                        } };
                    matrixSet.Identifier = new gView.Framework.OGC.WMTS.Version_1_0_0.CodeType()
                    {
                        Value = layerId + "_default_matrixset"
                    };
                    matrixSet.SupportedCRS = "urn:ogc:def:crs:EPSG::" + epsg;

                    matrixSet.TileMatrix = new gView.Framework.OGC.WMTS.Version_1_0_0.TileMatrix[metadata.Scales.Count];

                    #region DPI

                    double inchMeter = 0.0254;                    /* 0.0254000508001016;*/
                    double dpi       = inchMeter * 1000D / 0.28D; // wmts 0.28mm -> 1 Pixel;
                    double dpm       = dpi / inchMeter;

                    #endregion

                    for (int s = 0, to = metadata.Scales.Count; s < to; s++)
                    {
                        string scalePath = _mapServer.TileCachePath + @"/" + MapName(context) + @"/_alllayers/" + (cacheType == "compact" ? @"compact/" : "") +
                                           TileServiceMetadata.ScalePath(GridOrientation.UpperLeft, epsg, metadata.Scales[s]);

                        if (!new DirectoryInfo(scalePath).Exists)
                        {
                            break;
                        }

                        double resolution = metadata.Scales[s] / (metadata.Dpi / inchMeter);

                        matrixSet.TileMatrix[s]            = new gView.Framework.OGC.WMTS.Version_1_0_0.TileMatrix();
                        matrixSet.TileMatrix[s].Identifier = new gView.Framework.OGC.WMTS.Version_1_0_0.CodeType()
                        {
                            Value = s.ToString()
                        };
                        matrixSet.TileMatrix[s].TopLeftCorner = PointToString(origin, sRef);
                        matrixSet.TileMatrix[s].TileWidth     = metadata.TileWidth.ToString();
                        matrixSet.TileMatrix[s].TileHeight    = metadata.TileHeight.ToString();

                        double tileWidth  = metadata.TileWidth * resolution;
                        double tileHeight = metadata.TileHeight * resolution;

                        int matrixWidth  = (int)Math.Round(matrixSetWidth / tileWidth + 0.5);
                        int matrixHeight = (int)Math.Round(matrixSetHeight / tileHeight + 0.5);

                        matrixSet.TileMatrix[s].MatrixWidth      = matrixWidth.ToString();
                        matrixSet.TileMatrix[s].MatrixHeight     = matrixHeight.ToString();
                        matrixSet.TileMatrix[s].ScaleDenominator = resolution * dpm;
                    }

                    matrixSets.Add(matrixSet);

                    #endregion
                }
            }

            capabilities.Contents.DatasetDescriptionSummary = layers.ToArray();
            capabilities.Contents.TileMatrixSet             = matrixSets.ToArray();

            #endregion

            XsdSchemaSerializer <gView.Framework.OGC.WMTS.Version_1_0_0.Capabilities> ser = new XsdSchemaSerializer <gView.Framework.OGC.WMTS.Version_1_0_0.Capabilities>();
            string xml = ser.Serialize(capabilities, null);

            xml = xml.Replace(@"<ows:DatasetDescriptionSummary xsi:type=""LayerType"">", "<Layer>");
            xml = xml.Replace(@"</ows:DatasetDescriptionSummary>", "</Layer>");

            context.ServiceRequest.ResponseContentType = "text/xml";
            context.ServiceRequest.Response            = xml;
        }
コード例 #58
0
 public GossipReceived(IEnvelope envelope, ClusterInfo clusterInfo, IPEndPoint server)
 {
     Envelope    = envelope;
     ClusterInfo = clusterInfo;
     Server      = server;
 }
コード例 #59
0
        public override void OnMouseDown(int Button, int Shift, int X, int Y)
        {
            if (Button == 2)
            {
                return;
            }
            IPoint pt = m_hookHelper.ActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(X, Y);

            pt = GIS.GraphicEdit.SnapSetting.getSnapPoint(pt);
            IGraphicsContainer graphicContainer = m_hookHelper.ActiveView.GraphicsContainer;
            IEnvelope          pEnvBounds       = null;

            //获取上一次轨迹线的范围,以便确定刷新范围
            try
            {
                if (m_TracePolygon != null)
                {
                    m_TracePolygon.QueryEnvelope(pEnvBounds);
                    pEnvBounds.Expand(4, 4, true); //矩形框向四周扩大4倍(大于2倍就行),目的是为了保证有充足的刷新区域
                }
                else
                {
                    pEnvBounds = m_hookHelper.ActiveView.Extent;
                }
            }
            catch
            {
                pEnvBounds = m_hookHelper.ActiveView.Extent;
            }

            #region 启动画面
            if (m_NewPolygonFeedback == null)
            {
                //移除element
                RemoveElements();
                //刷新
                m_hookHelper.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);
                Application.DoEvents();

                m_NewPolygonFeedback = new NewPolygonFeedbackClass();

                //必须先得到symbol,后设置symbol
                ISimpleLineSymbol simpleLineSymbol = m_NewPolygonFeedback.Symbol as ISimpleLineSymbol;
                simpleLineSymbol.Style = esriSimpleLineStyle.esriSLSSolid;
                simpleLineSymbol.Width = 2;
                simpleLineSymbol.Color = TransColorToAEColor(Color.Blue);

                m_simpleFillSymbol.Outline = simpleLineSymbol;

                m_NewPolygonFeedback.Display = m_hookHelper.ActiveView.ScreenDisplay;
                m_NewPolygonFeedback.Start(pt);
            }
            else
            {
                m_NewPolygonFeedback.AddPoint(pt);
            }


            if (m_ptCollection == null)
            {
                m_ptCollection = new PolylineClass();
            }
            //记录节点
            object obj = Type.Missing;
            m_ptCollection.AddPoint(pt, ref obj, ref obj);

            #endregion

            #region 绘制结点

            try
            {
                IElement vertexElement = createElement_x(pt);
                //
                graphicContainer = m_hookHelper.ActiveView as IGraphicsContainer;

                //g.AddElement(vertexElement, 0);
                //g.MoveElementToGroup(vertexElement, m_VertexElement);

                m_VertexElement.AddElement(vertexElement);
                //刷新
                m_hookHelper.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, vertexElement, pEnvBounds);
            }
            catch
            { }
            #endregion

            try
            {
                if (m_ptCollection.PointCount >= 2)
                {
                    IPoint fromPt = m_ptCollection.get_Point(m_ptCollection.PointCount - 2); //倒数第二个点
                    IPoint toPt   = m_ptCollection.get_Point(m_ptCollection.PointCount - 1); //最后第一个点
                    ILine  line   = new LineClass();
                    line.PutCoords(fromPt, toPt);

                    #region 绘制轨迹线

                    try
                    {
                        object             missing = Type.Missing;
                        ISegmentCollection segColl = new PolylineClass();
                        segColl.AddSegment(line as ISegment, ref missing, ref missing);

                        IPolyline polyline = new PolylineClass();
                        polyline = segColl as IPolyline;
                        IElement traceElement = createElement_x(polyline);

                        //graphicContainer = m_hookHelper.ActiveView as IGraphicsContainer;
                        m_TraceElement.AddElement(traceElement);

                        m_hookHelper.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, traceElement, pEnvBounds);
                    }
                    catch
                    { }
                    #endregion

                    #region 计算单线的长度,并将结果显示在单线中点偏上上面
                    //try
                    //{
                    //    double angle = line.Angle;
                    //    if ((angle > (Math.PI / 2) && angle < (Math.PI)) || (angle > -Math.PI && angle < -(Math.PI / 2))) // 大于90度小于等于180
                    //        angle += Math.PI;

                    //    //标注点Y值偏移量
                    //    double d_OffsetY = m_hookHelper.ActiveView.ScreenDisplay.DisplayTransformation.FromPoints(9);

                    //    //标注点
                    //    double d_CenterX = (fromPt.X + toPt.X) / 2;
                    //    double d_CenterY = (fromPt.Y + toPt.Y) / 2 + d_OffsetY; //向上偏移

                    //    IPoint labelPt = new PointClass();
                    //    labelPt.PutCoords(d_CenterX, d_CenterY);

                    //    ITextElement txtElement = CreateTextElement(line.Length.ToString("0.00"));

                    //    IElement labelelement = txtElement as IElement;
                    //    labelelement.Geometry = labelPt;
                    //    object oElement = (object)labelelement;

                    //    //根据角度旋转
                    //    TransformByRotate(ref oElement, labelPt, angle);

                    //    ////添加到GraphicsContainer
                    //    //g.AddElement(labelelement, 0);

                    //    ////移到m_LabelElement组中
                    //    //g.MoveElementToGroup(labelelement, m_LabelElement);

                    //    //添加到组
                    //    m_LabelElement.AddElement(labelelement);

                    //    //刷新
                    //    m_hookHelper.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, labelelement, pEnvBounds);
                    //}
                    //catch
                    //{ }
                    #endregion
                }
            }
            catch
            { }

            m_frmMeasureResult.PolygonResultChange();
        }
コード例 #60
0
 public abstract void OnNext(IEnvelope envelope);