private void TryProjectEnvelopeOfClass() { if (!_isPrjed) { _prj.Project(_class.FullEnvelope); _isPrjed = true; } }
public void Project(IRuntimeProjecter projecter, enumCoordinateType toCoordinateType) { _runtimeProjecter = projecter; if (_toCoordinateType == enumCoordinateType.Geographic) { _runtimeProjecter.Project(_fullEnvelop); _toCoordinateType = enumCoordinateType.Projection; } }
public void Project(IRuntimeProjecter projecter, enumCoordinateType toCoordinateType) { if (_coordType == enumCoordinateType.Geographic) { _coordType = toCoordinateType; _currentRuntimeProjecter = projecter; // _currentRuntimeProjecter.Project(_fullEnvelope); // if (_grids == null || _grids.Count == 0) { return; } int n = _grids.Count; for (int i = 0; i < n; i++) { TryProject(_grids[i]); } } }
public void TryProject(IGrid grid) { if (_currentRuntimeProjecter == null) { return; } // if (!grid.CoordIsConverted) { _currentRuntimeProjecter.Project(grid.GridEnvelope); grid.CoordIsConverted = true; } // if (grid.VectorFeatures == null || grid.VectorFeatures.Count == 0) { return; } Shape shape = null; Feature[] fets = grid.VectorFeatures.ToArray(); int n = fets.Length; Feature fet = null; for (int i = 0; i < n; i++) { fet = fets[i]; // fet.SetFeatureClass(this); // if (fet.Projected) { continue; } //annotations if (fet.Annotations != null) { foreach (LabelLocation loc in fet.Annotations) { _currentRuntimeProjecter.Project(loc.Location); } } // Envelope newEnvelope = new Envelope(double.MaxValue, double.MaxValue, double.MinValue, double.MinValue); shape = fet.Geometry; if (shape == null || shape.IsProjected) { continue; } shape.IsProjected = true; shape.Envelope = newEnvelope; if (shape is ShapePoint) { _currentRuntimeProjecter.Project(shape as ShapePoint); UpdateEnvelopeByPoints(newEnvelope, new ShapePoint[] { shape as ShapePoint }); shape.UpdateCentroid(); } else if (shape is ShapePolyline) { ShapePolyline line = shape as ShapePolyline; foreach (ShapeLineString part in line.Parts) { _currentRuntimeProjecter.Project(part.Points); UpdateEnvelopeByPoints(newEnvelope, part.Points); } line.UpdateCentroid(); } else if (shape is ShapePolygon) { ShapePolygon ply = shape as ShapePolygon; foreach (ShapeRing ring in ply.Rings) { _currentRuntimeProjecter.Project(ring.Points); UpdateEnvelopeByPoints(newEnvelope, ring.Points); } ply.UpdateCentroid(); } if (fet.LabelLocationService == null) { fet.SetLabelLocationService(new LabelLocationServiceDefault(null)); } fet.LabelLocationService.Update(fet.Geometry); fet.Projected = true; } (grid as Grid).UpdateEnvelope(); }