private IElement CreateLineElement(IPoint pt, ILineSymbol pSymbol, IFillSymbol pBackSymbol, string des) { IGroupElement groupElementClass = new GroupElement() as IGroupElement; IPolyline polylineClass = new Polyline() as IPolyline; object missing = Type.Missing; IPoint pointClass = new ESRI.ArcGIS.Geometry.Point(); pointClass.PutCoords(pt.X + this.m_itemwidth / 10, pt.Y - this.m_itemheight / 2); (polylineClass as IPointCollection).AddPoint(pointClass, ref missing, ref missing); pointClass = new ESRI.ArcGIS.Geometry.Point(); pointClass.PutCoords(pt.X + this.m_itemwidth * 0.9, pt.Y - this.m_itemheight / 2); (polylineClass as IPointCollection).AddPoint(pointClass, ref missing, ref missing); IElement lineElementClass = new LineElement() { Geometry = polylineClass }; (lineElementClass as ILineElement).Symbol = pSymbol; if (pBackSymbol != null) { groupElementClass.AddElement(this.CreatePolygonElement(pt, pBackSymbol)); } else if (this.m_ItemHasBorder) { groupElementClass.AddElement(this.CreatePolygonElement(pt)); } groupElementClass.AddElement(lineElementClass); if (des.Length > 0) { groupElementClass.AddElement(this.CreateTextElement(pt, des, 10)); } return(groupElementClass as IElement); }
private IElement CreatePointElement(IPoint pt, IMarkerSymbol pSymbol, IFillSymbol pBackSymbol, string des) { IGroupElement groupElementClass = new GroupElement() as IGroupElement; IPoint pointClass = new ESRI.ArcGIS.Geometry.Point(); pointClass.PutCoords(pt.X + this.m_itemwidth / 2, pt.Y - this.m_itemheight / 2); IElement markerElementClass = new MarkerElement() { Geometry = pointClass }; (markerElementClass as IMarkerElement).Symbol = pSymbol; if (pBackSymbol != null) { groupElementClass.AddElement(this.CreatePolygonElement(pt, pBackSymbol)); } else if (this.m_ItemHasBorder) { groupElementClass.AddElement(this.CreatePolygonElement(pt)); } groupElementClass.AddElement(markerElementClass); if (des.Length > 0) { groupElementClass.AddElement(this.CreateTextElement(pt, des, 10)); } return(groupElementClass as IElement); }
private IElement CreatePolygonElement(IPoint pt, IFillSymbol pSymbol, IFillSymbol pBackSymbol, string des) { IGroupElement groupElementClass = new GroupElement() as IGroupElement; IPolygon polygonClass = new Polygon() as IPolygon; object missing = Type.Missing; IPoint pointClass = new ESRI.ArcGIS.Geometry.Point(); pointClass.PutCoords(pt.X, pt.Y); (polygonClass as IPointCollection).AddPoint(pointClass, ref missing, ref missing); pointClass = new ESRI.ArcGIS.Geometry.Point(); pointClass.PutCoords(pt.X, pt.Y - this.m_itemheight); (polygonClass as IPointCollection).AddPoint(pointClass, ref missing, ref missing); pointClass = new ESRI.ArcGIS.Geometry.Point(); pointClass.PutCoords(pt.X + this.m_itemwidth, pt.Y - this.m_itemheight); (polygonClass as IPointCollection).AddPoint(pointClass, ref missing, ref missing); pointClass = new ESRI.ArcGIS.Geometry.Point(); pointClass.PutCoords(pt.X + this.m_itemwidth, pt.Y); (polygonClass as IPointCollection).AddPoint(pointClass, ref missing, ref missing); pointClass = new ESRI.ArcGIS.Geometry.Point(); pointClass.PutCoords(pt.X, pt.Y); (polygonClass as IPointCollection).AddPoint(pointClass, ref missing, ref missing); IElement rectangleElementClass = new RectangleElement() { Geometry = polygonClass.Envelope }; (rectangleElementClass as IFillShapeElement).Symbol = pSymbol; if (pBackSymbol != null) { groupElementClass.AddElement(this.CreatePolygonElement(pt, pBackSymbol)); } else if (this.m_ItemHasBorder) { if (pSymbol.Outline != null) { IRgbColor color = pSymbol.Outline.Color as IRgbColor; if (color != null) { if ((color.Red < 212 || color.Green < 208 ? false : color.Blue >= 200)) { groupElementClass.AddElement(this.CreatePolygonElement(pt)); } } } else { groupElementClass.AddElement(this.CreatePolygonElement(pt)); } } groupElementClass.AddElement(rectangleElementClass); if (des.Length > 0) { groupElementClass.AddElement(this.CreateTextElement(pt, des, 10)); } return(groupElementClass as IElement); }
private void GroupElement(IGraphicsContainer pGC, IEnvelope pEnvelop) { IGroupElement2 groupElementClass = null; IGraphicsContainerSelect graphicsContainerSelect = pGC as IGraphicsContainerSelect; IEnumElement selectedElements = graphicsContainerSelect.SelectedElements; selectedElements.Reset(); IElement i = selectedElements.Next(); if (groupElementClass == null) { groupElementClass = new GroupElement() as IGroupElement2; (groupElementClass as IElement).Geometry = pEnvelop; while (i != null) { groupElementClass.AddElement(i); groupElementClass.Refresh(); i = selectedElements.Next(); } } pGC.AddElement(groupElementClass as IElement, -1); (groupElementClass as IElement).QueryBounds((pGC as IActiveView).ScreenDisplay, pEnvelop); selectedElements.Reset(); for (i = selectedElements.Next(); i != null; i = selectedElements.Next()) { pGC.DeleteElement(i); } graphicsContainerSelect.SelectElement(groupElementClass as IElement); }
/// <summary> /// 连接表 /// </summary> public IElement CreateJionTab(IActiveView pAV, IPoint Leftdown) { IGroupElement groupElementClass = new GroupElement() as IGroupElement; (groupElementClass as IElementProperties).Name = "接图表"; (groupElementClass as IElementProperties).Type = "接图表"; ILineSymbol lineSymbol = null; double num = this.height / 3; double num1 = this.width / 3; double num2 = 0.3; object missing = System.Type.Missing; IElement lineElementClass = new LineElement(); IElement element = new LineElement(); IElement lineElementClass1 = new LineElement(); IElement element1 = new LineElement(); IElement lineElementClass2 = new LineElement(); IPolyline polylineClass = new Polyline() as IPolyline; IPolyline polyline = new Polyline() as IPolyline; IPolyline polylineClass1 = new Polyline() as IPolyline; IPolyline polyline1 = new Polyline() as IPolyline; IPolyline polylineClass2 = new Polyline() as IPolyline; IPointCollection pointCollection = polylineClass as IPointCollection; IPoint pointClass = new ESRI.ArcGIS.Geometry.Point(); IPoint point = new ESRI.ArcGIS.Geometry.Point(); IPoint pointClass1 = new ESRI.ArcGIS.Geometry.Point(); IPoint point1 = new ESRI.ArcGIS.Geometry.Point(); try { lineSymbol = this.LineSymbol; (lineElementClass as ILineElement).Symbol = lineSymbol; (element as ILineElement).Symbol = lineSymbol; (lineElementClass1 as ILineElement).Symbol = lineSymbol; (element1 as ILineElement).Symbol = lineSymbol; (lineElementClass2 as ILineElement).Symbol = lineSymbol; point.PutCoords(Leftdown.X, Leftdown.Y + num2); pointClass.PutCoords(Leftdown.X, Leftdown.Y + num2 + this.height); pointClass1.PutCoords(Leftdown.X + this.width, Leftdown.Y + num2); point1.PutCoords(Leftdown.X + this.width, Leftdown.Y + num2 + this.height); pointCollection.AddPoint(pointClass, ref missing, ref missing); pointCollection.AddPoint(point, ref missing, ref missing); pointCollection.AddPoint(pointClass1, ref missing, ref missing); pointCollection.AddPoint(point1, ref missing, ref missing); pointCollection.AddPoint(pointClass, ref missing, ref missing); lineElementClass.Geometry = polylineClass; groupElementClass.AddElement(lineElementClass); IPoint pointClass2 = new ESRI.ArcGIS.Geometry.Point(); IPoint point2 = new ESRI.ArcGIS.Geometry.Point(); pointClass2.PutCoords(pointClass.X, pointClass.Y - num); point2.PutCoords(point1.X, point1.Y - num); pointCollection = polyline as IPointCollection; pointCollection.AddPoint(pointClass2, ref missing, ref missing); pointCollection.AddPoint(point2, ref missing, ref missing); element.Geometry = polyline; groupElementClass.AddElement(element); pointClass2.PutCoords(pointClass.X, pointClass.Y - num * 2); point2.PutCoords(point1.X, point1.Y - num * 2); pointCollection = polylineClass1 as IPointCollection; pointCollection.AddPoint(pointClass2, ref missing, ref missing); pointCollection.AddPoint(point2, ref missing, ref missing); lineElementClass1.Geometry = polylineClass1; groupElementClass.AddElement(lineElementClass1); pointClass2.PutCoords(pointClass.X + num1, pointClass.Y); point2.PutCoords(pointClass.X + num1, point.Y); pointCollection = polyline1 as IPointCollection; pointCollection.AddPoint(pointClass2, ref missing, ref missing); pointCollection.AddPoint(point2, ref missing, ref missing); element1.Geometry = polyline1; groupElementClass.AddElement(element1); pointClass2.PutCoords(pointClass.X + num1 * 2, pointClass.Y); point2.PutCoords(pointClass.X + num1 * 2, point.Y); pointCollection = polylineClass2 as IPointCollection; pointCollection.AddPoint(pointClass2, ref missing, ref missing); pointCollection.AddPoint(point2, ref missing, ref missing); lineElementClass2.Geometry = polylineClass2; groupElementClass.AddElement(lineElementClass2); IPolygon polygonClass = new Polygon() as IPolygon; IElement polygonElementClass = new PolygonElement(); IPolygonElement polygonElement = polygonElementClass as IPolygonElement; ISimpleFillSymbol simpleFillSymbolClass = new SimpleFillSymbol(); IFillShapeElement fillShapeElement = polygonElement as IFillShapeElement; IRgbColor rgbColorClass = new RgbColor() { Red = 0, Green = 0, Blue = 0 }; simpleFillSymbolClass.Outline = this.LineSymbol; simpleFillSymbolClass.Color = rgbColorClass; simpleFillSymbolClass.Style = esriSimpleFillStyle.esriSFSBackwardDiagonal; fillShapeElement.Symbol = simpleFillSymbolClass; pointCollection = polygonClass as IPointCollection; pointClass2.PutCoords(pointClass.X + num1, pointClass.Y - num); pointCollection.AddPoint(pointClass2, ref missing, ref missing); pointClass2.PutCoords(pointClass.X + num1 * 2, pointClass.Y - num); pointCollection.AddPoint(pointClass2, ref missing, ref missing); pointClass2.PutCoords(pointClass.X + num1 * 2, pointClass.Y - num * 2); pointCollection.AddPoint(pointClass2, ref missing, ref missing); pointClass2.PutCoords(pointClass.X + num1, pointClass.Y - num * 2); pointCollection.AddPoint(pointClass2, ref missing, ref missing); polygonClass.Close(); polygonElementClass.Geometry = polygonClass; groupElementClass.AddElement(polygonElementClass); IEnvelope envelope = polygonClass.Envelope; IEnvelope envelopeClass = new Envelope() as IEnvelope; this.m_pTextElementList.Add( this.CreateJionTabTextElement(pAV, this.Row1Col1Text, pointClass.X + num1 / 2, pointClass.Y - num / 2, envelope) as ITextElement); this.m_pTextElementAdd.Add(true); groupElementClass.AddElement(this.m_pTextElementList[0] as IElement); this.m_pTextElementList.Add( this.CreateJionTabTextElement(pAV, this.Row1Col2Text, pointClass.X + 1.5 * num1, pointClass.Y - 0.5 * num, envelope) as ITextElement); this.m_pTextElementAdd.Add(true); groupElementClass.AddElement(this.m_pTextElementList[1] as IElement); this.m_pTextElementList.Add( this.CreateJionTabTextElement(pAV, this.Row1Col3Text, pointClass.X + 2.5 * num1, pointClass.Y - 0.5 * num, envelope) as ITextElement); this.m_pTextElementAdd.Add(true); groupElementClass.AddElement(this.m_pTextElementList[2] as IElement); this.m_pTextElementList.Add( this.CreateJionTabTextElement(pAV, this.Row2Col1Text, pointClass.X + num1 / 2, pointClass.Y - 1.5 * num, envelope) as ITextElement); this.m_pTextElementAdd.Add(true); groupElementClass.AddElement(this.m_pTextElementList[3] as IElement); this.m_pTextElementList.Add(null); this.m_pTextElementAdd.Add(false); this.m_pTextElementList.Add( this.CreateJionTabTextElement(pAV, this.Row2Col3Text, pointClass.X + 2.5 * num1, pointClass.Y - 1.5 * num, envelope) as ITextElement); this.m_pTextElementAdd.Add(true); groupElementClass.AddElement(this.m_pTextElementList[5] as IElement); this.m_pTextElementList.Add( this.CreateJionTabTextElement(pAV, this.Row3Col1Text, pointClass.X + num1 / 2, pointClass.Y - 2.5 * num, envelope) as ITextElement); this.m_pTextElementAdd.Add(true); groupElementClass.AddElement(this.m_pTextElementList[6] as IElement); this.m_pTextElementList.Add( this.CreateJionTabTextElement(pAV, this.Row3Col2Text, pointClass.X + 1.5 * num1, pointClass.Y - 2.5 * num, envelope) as ITextElement); this.m_pTextElementAdd.Add(true); groupElementClass.AddElement(this.m_pTextElementList[7] as IElement); this.m_pTextElementList.Add( this.CreateJionTabTextElement(pAV, this.Row3Col3Text, pointClass.X + 2.5 * num1, pointClass.Y - 2.5 * num, envelope) as ITextElement); this.m_pTextElementAdd.Add(true); groupElementClass.AddElement(this.m_pTextElementList[8] as IElement); } catch (Exception exception) { } this.m_pGroupElement = groupElementClass as IElement; return(this.m_pGroupElement); }
/// <summary> /// </summary> /// <param name="pt">定位点</param> public void Create(IActiveView pAV, IPoint pt) { int count = this.m_symbolLists.Count / this.m_colum; if ((double)count * this.m_colspace < (double)this.m_symbolLists.Count) { count++; } int num = 0; double num1 = 0; double height = 0; IGroupElement groupElementClass = new GroupElement() as IGroupElement; pt.X = pt.X + 0.1; pt.Y = pt.Y + 0.1; if (this.m_Title.Length > 0) { IElement element = this.CreateTitleElement(pt); IEnvelope envelopeClass = new Envelope() as IEnvelope; element.QueryBounds(pAV.ScreenDisplay, envelopeClass); height = envelopeClass.Height; groupElementClass.AddElement(element); } double x = pt.X; double y = pt.Y - height; IPoint pointClass = new ESRI.ArcGIS.Geometry.Point(); IEnvelope envelope = new Envelope() as IEnvelope; for (int i = 0; i < this.m_symbolLists.Count; i++) { ISymbol item = this.m_symbolLists[i]; pointClass.PutCoords(x, y); IElement element1 = this.CreateElement(pointClass, this.m_symbolLists[i], this.m_backsymbolLists[i] as IFillSymbol, this.m_symbolDescriptions[i]); element1.QueryBounds(pAV.ScreenDisplay, envelope); if (!(element1 is IGroupElement)) { groupElementClass.AddElement(element1); } else { for (int j = 0; j < (element1 as IGroupElement).ElementCount; j++) { groupElementClass.AddElement((element1 as IGroupElement).Element[j]); } } (groupElementClass as IGroupElement2).Refresh(); num1 = (num1 > envelope.Width ? num1 : envelope.Width); y = y - this.m_itemheight - this.m_rowspace; num++; if (num == count) { y = pt.Y - height; x = x + (num1 + this.m_colspace); num = 0; num1 = 0; } } IEnvelope envelopeClass1 = new Envelope() as IEnvelope; (groupElementClass as IElement).QueryBounds(pAV.ScreenDisplay, envelopeClass1); envelopeClass1.Expand(0.05, 0.05, false); try { if (this.m_HasBorder) { IRgbColor rgbColorClass = new RgbColor() { Red = 255, Blue = 255, Green = 255 }; groupElementClass.AddElement(this.CreatePolygonElement(envelopeClass1, rgbColorClass)); } (groupElementClass as IElement).QueryBounds(pAV.ScreenDisplay, envelopeClass1); (groupElementClass as ITransform2D).Scale(envelopeClass1.UpperLeft, 1, 1); (pAV as IGraphicsContainer).AddElement(groupElementClass as IElement, -1); } catch (Exception exception) { } pAV.PartialRefresh(esriViewDrawPhase.esriViewGraphics, groupElementClass, null); }
public IElement CreateElement(IActiveView pAV, IPoint pt) { IElement element; double num = 0; int count = this.m_symbolLists.Count / this.m_colum; if (count * this.m_colum < this.m_symbolLists.Count) { count++; } int num1 = 0; double num2 = 0; double height = 0; double y = pt.Y + 0.1; IGroupElement groupElementClass = new GroupElement() as IGroupElement; IEnvelope envelopeClass = new Envelope() as IEnvelope; envelopeClass.PutCoords(pt.X + 0.1, pt.Y + 0.1, pt.X + 0.1, pt.Y + 0.1); IRgbColor rgbColorClass = new RgbColor() { Red = 255, Blue = 255, Green = 255 }; IElement element1 = this.CreatePolygonElement(envelopeClass, rgbColorClass); groupElementClass.AddElement(element1); pt.X = pt.X + 0.1; pt.Y = pt.Y + 0.1; IElement element2 = null; if (this.m_Title.Length > 0) { element2 = this.CreateTitleElement(pt); IEnvelope envelope = new Envelope() as IEnvelope; element2.QueryBounds(pAV.ScreenDisplay, envelope); height = envelope.Height; groupElementClass.AddElement(element2); } double x = pt.X; double mItemheight = pt.Y - height - this.m_rowspace; IPoint pointClass = new ESRI.ArcGIS.Geometry.Point(); IEnvelope envelopeClass1 = new Envelope() as IEnvelope; List <double> nums = new List <double>(); List <double> nums1 = new List <double>(); if (height > 0) { nums.Add(mItemheight + this.m_rowspace / 2); } bool flag = false; for (int i = 0; i < this.m_symbolLists.Count; i++) { ISymbol item = this.m_symbolLists[i]; pointClass.PutCoords(x, mItemheight); element = this.CreateElement(pointClass, this.m_symbolLists[i], this.m_backsymbolLists[i] as IFillSymbol, this.m_symbolDescriptions[i]); element.QueryBounds(pAV.ScreenDisplay, envelopeClass1); if (!(element is IGroupElement)) { groupElementClass.AddElement(element); } else { int elementCount = (element as IGroupElement).ElementCount; for (int j = 0; j < (element as IGroupElement).ElementCount; j++) { groupElementClass.AddElement((element as IGroupElement).Element[j]); } } num2 = (num2 > envelopeClass1.Width ? num2 : envelopeClass1.Width); mItemheight = mItemheight - this.m_itemheight - this.m_rowspace; num1++; if (num1 == count) { mItemheight = pt.Y - height - this.m_rowspace; nums1.Add(x + this.m_itemwidth + this.m_space / 2); x = x + (num2 + this.m_colspace); nums1.Add(x - this.m_colspace / 2); num1 = 0; num2 = 0; flag = true; } else if (!flag) { nums.Add(mItemheight + this.m_rowspace / 2); } } if (num1 != count) { mItemheight = pt.Y - height - this.m_rowspace; nums1.Add(x + this.m_itemwidth + this.m_space / 2); x = x + (num2 + this.m_colspace); nums1.Add(x - this.m_colspace / 2); } IEnvelope envelope1 = new Envelope() as IEnvelope; (groupElementClass as IElement).QueryBounds(pAV.ScreenDisplay, envelope1); (groupElementClass as IElement).Activate(pAV.ScreenDisplay); envelope1.Expand(0.05, 0.05, false); try { if (!this.m_HasBorder) { groupElementClass.DeleteElement(element1); } else { IRgbColor rgbColorClass1 = new RgbColor() { Red = 255, Blue = 255, Green = 255 }; (groupElementClass as IGroupElement3).ReplaceElement(element1, this.CreatePolygonElement(envelope1, rgbColorClass1)); } (groupElementClass as IElement).QueryBounds(pAV.ScreenDisplay, envelope1); if (this.m_isdrawline) { foreach (double num3 in nums) { element = this.CreateLineElement(envelope1.XMin, num3, envelope1.XMax, num3); groupElementClass.AddElement(element); } double yMax = envelope1.YMax; if (nums.Count > 0) { if (height > 0) { yMax = nums[0]; } } if (nums1.Count > 0) { nums1.RemoveAt(nums1.Count - 1); } foreach (double num3 in nums1) { element = this.CreateLineElement(num3, envelope1.YMin, num3, yMax); groupElementClass.AddElement(element); } (groupElementClass as IElement).QueryBounds(pAV.ScreenDisplay, envelope1); } this.m_pEnvelop = envelope1; } catch (Exception exception) { } if (element2 != null) { IPoint point = new ESRI.ArcGIS.Geometry.Point(); point.PutCoords((envelope1.XMin + envelope1.XMax) / 2, y); element2.Geometry = point; (element2 as ITextElement).Symbol = this.FontStyle(20, esriTextHorizontalAlignment.esriTHACenter, esriTextVerticalAlignment.esriTVATop); } (groupElementClass as IElementProperties).Name = "图例"; (groupElementClass as IElement).Geometry = envelope1; return(groupElementClass as IElement); }
public void Create(IActiveView pAV, IEnvelope pEnvelop) { IPoint upperLeft = pEnvelop.UpperLeft; int count = this.m_symbolLists.Count / this.m_colum; if ((double)count * this.m_colspace < (double)this.m_symbolLists.Count) { count++; } int num = 0; double num1 = 0; double height = 0; upperLeft.X = upperLeft.X + 0.1; upperLeft.Y = upperLeft.Y + 0.1; IGroupElement groupElementClass = new GroupElement() as IGroupElement; if (this.m_Title.Length > 0) { IElement element = this.CreateTitleElement(upperLeft); IEnvelope envelopeClass = new Envelope() as IEnvelope; element.QueryBounds(pAV.ScreenDisplay, envelopeClass); height = envelopeClass.Height; groupElementClass.AddElement(element); } double x = upperLeft.X; double y = upperLeft.Y - height; IPoint pointClass = new ESRI.ArcGIS.Geometry.Point(); IEnvelope envelope = new Envelope() as IEnvelope; for (int i = 0; i < this.m_symbolLists.Count; i++) { ISymbol item = this.m_symbolLists[i]; pointClass.PutCoords(x, y); IElement element1 = this.CreateElement(pointClass, this.m_symbolLists[i], this.m_backsymbolLists[i] as IFillSymbol, this.m_symbolDescriptions[i]); element1.QueryBounds(pAV.ScreenDisplay, envelope); if (!(element1 is IGroupElement)) { groupElementClass.AddElement(element1); } else { for (int j = 0; j < (element1 as IGroupElement).ElementCount; j++) { groupElementClass.AddElement((element1 as IGroupElement).Element[j]); } } num1 = (num1 > envelope.Width ? num1 : envelope.Width); y = y - this.m_itemheight - this.m_rowspace; num++; if (num == count) { y = upperLeft.Y - height; x = x + (num1 + this.m_colspace); num = 0; } } (groupElementClass as IElement).QueryBounds(pAV.ScreenDisplay, envelope); double width = pEnvelop.Width / envelope.Width; double height1 = pEnvelop.Height / envelope.Height; pEnvelop.Expand(-0.05, -0.05, false); (groupElementClass as ITransform2D).Scale(pEnvelop.UpperLeft, width, height1); pEnvelop.Expand(0.05, 0.05, false); if (this.m_HasBorder) { groupElementClass.AddElement(this.CreatePolygonElement(pEnvelop)); } (pAV as IGraphicsContainer).AddElement(groupElementClass as IElement, -1); pAV.PartialRefresh(esriViewDrawPhase.esriViewGraphics, groupElementClass, null); }
public static IGroupElement CreateRoadSurfaceFromPolygon(IFeature ifeature_0, IFeature3DProperties ifeature3DProperties_0, clsTextureGroup clsTextureGroup_0, ISurface isurface_0, string string_0, IPolygon ipolygon_0, bool bool_0) { IGroupElement groupElement = null; IGroupElement result; try { IEncode3DProperties encode3DProperties = new GeometryEnvironment() as IEncode3DProperties; IGroupElement groupElement2 = new GroupElement() as IGroupElement; if (modFacades.m_limitAngle == 0.0) { modFacades.m_limitAngle = 0.5235987666666666; } IGeometry geometry = null; if (ifeature_0 != null) { if (ifeature3DProperties_0 != null && bool_0) { ifeature3DProperties_0.ApplyFeatureProperties(ifeature_0, out geometry, false); modFacades.g_bFeaturePropertiesApplied = true; } else { geometry = ifeature_0.Shape; modFacades.g_bFeaturePropertiesApplied = false; } } else if (ipolygon_0 != null) { geometry = ipolygon_0; } if (geometry == null) { result = groupElement; return(result); } if (!(geometry is IMultiPatch)) { } IEnvelope envelope = geometry.Envelope; double num = envelope.ZMin; if (modFacades.IsNaN(num)) { num = 0.0; } double num2 = 0.0; I3DProperties i3DProperties = ifeature3DProperties_0 as I3DProperties; if (i3DProperties.OffsetExpressionString.Length > 0) { num2 = Convert.ToDouble(i3DProperties.OffsetExpressionString); } if (geometry is IPolygon) { num += num2; } IGeometryCollection geometryCollection = geometry as IGeometryCollection; int geometryCount = geometryCollection.GeometryCount; int num3; if (geometry is IMultiPatch) { geometryCount = geometryCollection.GeometryCount; num3 = geometryCollection.GeometryCount * 2 / 3; modFacades.m_extrusionHeight = geometry.Envelope.ZMax - geometry.Envelope.ZMin; } else { num3 = 0; geometryCount = geometryCollection.GeometryCount; } if (modFacades.m_extrusionHeight >= 1.0) { } for (int i = num3; i <= geometryCount - 1; i++) { IGeometry geometry2 = geometryCollection.get_Geometry(i); esriGeometryType geometryType = geometry2.GeometryType; if (geometryType == esriGeometryType.esriGeometryRing || geometryType == esriGeometryType.esriGeometryPolyline) { } IPointCollection pointCollection = geometry2 as IPointCollection; int pointCount = pointCollection.PointCount; if (pointCount >= 2) { } IVector3D vector3D = new Vector3D() as IVector3D; vector3D.XComponent = 0.0; vector3D.YComponent = 0.0; vector3D.ZComponent = 1.0; double m = 0.0; encode3DProperties.PackNormal(vector3D, out m); IPointCollection pointCollection2 = new Ring(); object value = Missing.Value; short num4 = 0; while ((int)num4 <= pointCount - 1) { IPoint point = pointCollection.get_Point((int)num4); point.Z = num; point.M = m; IClone clone = point as IClone; pointCollection2.AddPoint(clone.Clone() as IPoint, ref value, ref value); num4 += 1; } IRing ring = pointCollection2 as IRing; ring.Close(); IMultiPatch multiPatch = new MultiPatch() as IMultiPatch; IGeometryCollection geometryCollection2 = multiPatch as IGeometryCollection; IZAware iZAware = multiPatch as IZAware; iZAware.ZAware = true; IMAware iMAware = multiPatch as IMAware; iMAware.MAware = true; geometryCollection2.AddGeometry(pointCollection2 as IGeometry, ref value, ref value); multiPatch.PutRingType(pointCollection2 as IRing, esriMultiPatchRingType.esriMultiPatchOuterRing); IElement element = modFacades.CreateElement(multiPatch, clsTextureGroup_0.RoofSymbol, string_0 + ";ROOFCOLOR=" + clsTextureGroup_0.RoofColorRGB.ToString()); if (element != null) { groupElement2.AddElement(element); } } if (groupElement2 != null) { IElementProperties elementProperties = groupElement2 as IElementProperties; elementProperties.Name = string_0; } groupElement = groupElement2; result = groupElement; return(result); } catch { } result = groupElement; return(result); }
public static IGroupElement CreateFacadesFromPolygon(IFeature ifeature_0, IFeature3DProperties ifeature3DProperties_0, clsTextureGroup clsTextureGroup_0, ISurface isurface_0, string string_0, IPolygon ipolygon_0, bool bool_0) { IGroupElement groupElement = null; IGroupElement result; try { IEncode3DProperties encode3DProperties = new GeometryEnvironment() as IEncode3DProperties; IGroupElement groupElement2 = new GroupElement() as IGroupElement; if (modFacades.m_limitAngle == 0.0) { modFacades.m_limitAngle = 0.5235987666666666; } IGeometry geometry = null; if (ifeature_0 != null) { if (ifeature3DProperties_0 != null && bool_0) { ifeature3DProperties_0.ApplyFeatureProperties(ifeature_0, out geometry, false); } else { geometry = ifeature_0.Shape; } } else if (ipolygon_0 != null) { geometry = ipolygon_0; } if (geometry == null) { result = null; return(result); } if (!(geometry is IMultiPatch)) { } IEnvelope envelope = geometry.Envelope; double num = envelope.ZMin; ISpatialReference spatialReference = BuildingProperty.Scene.SpatialReference; geometry.Project(spatialReference); string a = num.ToString(); if (a.Equals("非数字")) { num = 0.0; } double num2 = 0.0; if (ifeature3DProperties_0 != null) { I3DProperties i3DProperties = ifeature3DProperties_0 as I3DProperties; if (i3DProperties.OffsetExpressionString.Length > 0) { try { num2 = Convert.ToDouble(i3DProperties.OffsetExpressionString); } catch { } } if (geometry is IPolygon) { num += num2; } } IGeometryCollection geometryCollection = geometry as IGeometryCollection; int geometryCount = geometryCollection.GeometryCount; int num3; if (geometry is IMultiPatch) { geometryCount = geometryCollection.GeometryCount; num3 = geometryCollection.GeometryCount * 2 / 3; modFacades.m_extrusionHeight = geometry.Envelope.ZMax - geometry.Envelope.ZMin; } else { num3 = 0; geometryCount = geometryCollection.GeometryCount; } if (modFacades.m_extrusionHeight < 1.0) { modFacades.m_extrusionHeight = 1.0; } IPoint point = null; double num4 = 0.0; double num5 = 0.0; double num6 = 0.0; object value = Missing.Value; for (int i = num3; i < geometryCount; i++) { IGeometry geometry2 = geometryCollection.get_Geometry(i); esriGeometryType geometryType = geometry2.GeometryType; if (geometryType == esriGeometryType.esriGeometryRing || geometryType == esriGeometryType.esriGeometryPolyline) { IPointCollection pointCollection = geometry2 as IPointCollection; int pointCount = pointCollection.PointCount; if (pointCount >= 2) { int num7 = 0; int num8 = 1; bool flag = false; IPointCollection pointCollection2; double m; IMultiPatch multiPatch; IGeometryCollection geometryCollection2; IZAware iZAware; IMAware iMAware; IElement element; while (!flag) { bool flag2 = false; while (num8 < pointCount && !flag2) { if (num8 - num7 == 1) { IPoint point2 = pointCollection.get_Point(num7); point = pointCollection.get_Point(num8); num5 = point.X - point2.X; num6 = point.Y - point2.Y; num4 = Math.Sqrt(num5 * num5 + num6 * num6); if (isurface_0 != null) { num = isurface_0.get_Z(point.X, point.Y); num += num2; } } else { IPoint point2 = point; double num9 = num5; double num10 = num6; point = pointCollection.get_Point(num8); if (isurface_0 != null) { num = isurface_0.get_Z(point.X, point.Y); num += num2; } num5 = point.X - point2.X; num6 = point.Y - point2.Y; double num11 = Math.Sqrt(num9 * num9 + num10 * num10); double num12 = Math.Sqrt(num5 * num5 + num6 * num6); double num13 = (num9 * num5 + num10 * num6) / (num11 * num12); if (num13 < Math.Cos(modFacades.m_limitAngle)) { flag2 = true; break; } num4 += num12; } num8++; } if (flag2) { num8--; } else { num8--; } pointCollection2 = new TriangleStrip(); double num14 = 0.0; for (int j = num7; j <= num8; j++) { if (j > 0) { IPoint point2 = point; point = pointCollection.get_Point(j); num5 = point.X - point2.Y; num6 = point.Y - point2.Y; num14 += Math.Sqrt(num5 * num5 + num6 * num6); } else { point = pointCollection.get_Point(j); } point.Z = num; m = 0.0; encode3DProperties.PackTexture2D(num14 / num4, 0.0, out m); point.M = m; IClone clone = point as IClone; pointCollection2.AddPoint(clone.Clone() as IPoint, ref value, ref value); point.Z = num + modFacades.m_extrusionHeight; m = 0.0; encode3DProperties.PackTexture2D(num14 / num4, -1.0, out m); point.M = m; pointCollection2.AddPoint(clone.Clone() as IPoint, ref value, ref value); } multiPatch = new MultiPatch() as IMultiPatch; geometryCollection2 = (multiPatch as IGeometryCollection); iZAware = (multiPatch as IZAware); iZAware.ZAware = true; iMAware = (multiPatch as IMAware); iMAware.MAware = true; geometryCollection2.AddGeometry(pointCollection2 as IGeometry, ref value, ref value); if (clsTextureGroup_0 != null) { int index = modFacades.FindTextureByAspect(clsTextureGroup_0, num4 / modFacades.m_extrusionHeight); element = modFacades.CreateElement(multiPatch, clsTextureGroup_0.Symbols[index], string_0); } else { element = modFacades.CreateElement(multiPatch, null, string_0); } if (element != null) { groupElement2.AddElement(element); } num7 = num8; num8 = num7 + 1; if (num7 >= pointCount - 1) { flag = true; } } IVector3D vector3D = new Vector3D() as IVector3D; vector3D.XComponent = 0.0; vector3D.YComponent = 0.0; vector3D.ZComponent = 1.0; m = 0.0; encode3DProperties.PackNormal(vector3D, out m); pointCollection2 = new Ring(); for (int j = 0; j <= pointCount - 1; j++) { IPoint point3 = pointCollection.get_Point(j); point3.Z = num + modFacades.m_extrusionHeight; point3.M = 0.0; IClone clone = point3 as IClone; pointCollection2.AddPoint(clone.Clone() as IPoint, ref value, ref value); } IRing ring = pointCollection2 as IRing; ring.Close(); multiPatch = new MultiPatch() as IMultiPatch; geometryCollection2 = (multiPatch as IGeometryCollection); iZAware = (multiPatch as IZAware); iZAware.ZAware = true; iMAware = (multiPatch as IMAware); iMAware.MAware = true; geometryCollection2.AddGeometry(pointCollection2 as IGeometry, ref value, ref value); multiPatch.PutRingType(pointCollection2 as IRing, esriMultiPatchRingType.esriMultiPatchOuterRing); if (clsTextureGroup_0 != null) { element = modFacades.CreateElement(multiPatch, clsTextureGroup_0.RoofSymbol, string_0 + ";ROOFCOLOR=" + clsTextureGroup_0.RoofColorRGB.ToString()); } else { element = modFacades.CreateElement(multiPatch, null, string_0 + ";ROOFCOLOR=1"); } if (element != null) { groupElement2.AddElement(element); } } } } if (groupElement2 != null) { IElementProperties elementProperties = groupElement2 as IElementProperties; elementProperties.Name = string_0; } groupElement = groupElement2; result = groupElement; return(result); } catch { } result = groupElement; return(result); }
public void CreateTable(IActiveView pAV, IPoint Leftdown, object tabcell) { IPoint y; int i; this.m_tabcellText = tabcell as SortedList <int, SortedList <int, string> >; IGroupElement groupElementClass = new GroupElement() as IGroupElement; (groupElementClass as IElementProperties).Name = "表格"; (groupElementClass as IElementProperties).Type = "表格"; IEnvelope envelope1 = new Envelope() as IEnvelope; envelope1.XMin = Leftdown.X; envelope1.YMin = Leftdown.Y; envelope1.XMax = Leftdown.X + this.Width; envelope1.YMax = Leftdown.Y + this.Height; IEnvelope envelopeClass = envelope1 as IEnvelope; IEnvelope envelope = envelopeClass; IFillSymbol simpleFillSymbolClass = new SimpleFillSymbol(); (simpleFillSymbolClass as ISimpleFillSymbol).Style = esriSimpleFillStyle.esriSFSNull; IRectangleElement rectangleElement = new RectangleElement() as IRectangleElement; ((IElement)rectangleElement).Geometry = envelope; ((IFillShapeElement)rectangleElement).Symbol = simpleFillSymbolClass; IRectangleElement rectangleElementClass = rectangleElement as IRectangleElement; groupElementClass.AddElement(rectangleElement as IElement); IPoint pointClass = new Point() { X = Leftdown.X, Y = Leftdown.Y + this.Height }; IPoint point = pointClass; double height = this.Height / (double)this.RowNumber; double width = this.Width / (double)this.ColumnNumber; if (this.HasUpperBoundLine) { groupElementClass.AddElement(this.CreateHLine(point)); } if (this.HasLowerBoundLine) { groupElementClass.AddElement(this.CreateHLine(Leftdown)); } if (this.HasInnerHorizontalLine) { IPoint pointClass1 = new Point() { X = point.X, Y = point.Y - height }; y = pointClass1; groupElementClass.AddElement(this.CreateHLine(y)); if (!this.OnlyFirstHorizontalLine) { for (i = 0; i < this.RowNumber - 2; i++) { y.Y = y.Y - height; groupElementClass.AddElement(this.CreateHLine(y)); } } } if (this.HasLeftBoundLine) { groupElementClass.AddElement(this.CreateVLine(Leftdown)); } if (this.HasRightBoundLine) { IPoint pointClass2 = new Point() { X = Leftdown.X + this.Width, Y = Leftdown.Y }; groupElementClass.AddElement(this.CreateVLine(pointClass2)); } if (this.HasInnerVerticalLine) { IPoint pointClass3 = new Point() { X = Leftdown.X + width, Y = Leftdown.Y }; y = pointClass3; groupElementClass.AddElement(this.CreateVLine(y)); if (!this.OnlyFirstVerticalLine) { for (i = 0; i < this.ColumnNumber - 2; i++) { y.X = y.X + width; groupElementClass.AddElement(this.CreateVLine(y)); } } } IPoint pointClass4 = new Point() { X = point.X, Y = point.Y }; IPoint y1 = pointClass4; for (i = 0; i < this.RowNumber; i++) { IPoint pointClass5 = new Point() { X = y1.X, Y = y1.Y }; IPoint x = pointClass5; for (int j = 0; j < this.ColumnNumber; j++) { string cellText = this.GetCellText(i, j); if (cellText.Length > 0) { IElement element = this.CreateTabTextElement(pAV, cellText, x.X, x.Y - height / 2); groupElementClass.AddElement(element); this.SetTableCell(i, j, element); } x.X = x.X + width; } y1.Y = y1.Y - height; } this.m_pGroupElement = groupElementClass as IElement; }