public static IGraphicsContainer3D Add3DGraphicsLayer(string string_0, ISceneGraph isceneGraph_0) { IGraphicsContainer3D result = null; IScene scene = isceneGraph_0.Scene; bool flag = false; if (scene.LayerCount > 0) { IEnumLayer enumLayer = scene.get_Layers(null, true); enumLayer.Reset(); for (ILayer layer = enumLayer.Next(); layer != null; layer = enumLayer.Next()) { if (layer.Name == string_0 && layer is IGraphicsContainer3D) { result = (layer as IGraphicsContainer3D); flag = true; break; } } } if (!flag) { ILayer layer2 = new GraphicsLayer3D(); layer2.Name = string_0; scene.AddLayer(layer2, true); result = (layer2 as IGraphicsContainer3D); Utils3D.RefreshApp(isceneGraph_0); } return(result); }
public static IPolycurve DensifyPolycurve(ref IPolycurve ipolycurve_0, ref int int_0) { IPolycurve polycurve = Utils3D.CreateClone(ipolycurve_0 as IClone) as IPolycurve; polycurve.Densify(Convert.ToDouble(polycurve.Length / (double)int_0), 0.0); return(polycurve); }
public static IMultiPatch EnvelopeToBoundingBox(IEnvelope2 ienvelope2_0) { object value = Missing.Value; double double_; double double_2; double double_3; double double_4; ienvelope2_0.QueryCoords(out double_, out double_2, out double_3, out double_4); double zMin = ienvelope2_0.ZMin; double zMax = ienvelope2_0.ZMax; IMultiPatch multiPatch = new MultiPatch() as IMultiPatch; IGeometryCollection geometryCollection = multiPatch as IGeometryCollection; IPointCollection pointCollection = new TriangleStrip(); Utils3D.MakeZMAware(pointCollection as IGeometry, true); pointCollection.AddPoint(Utils3D.Create3DPoint(double_, double_2, zMin), ref value, ref value); pointCollection.AddPoint(Utils3D.Create3DPoint(double_, double_2, zMax), ref value, ref value); pointCollection.AddPoint(Utils3D.Create3DPoint(double_3, double_2, zMin), ref value, ref value); pointCollection.AddPoint(Utils3D.Create3DPoint(double_3, double_2, zMax), ref value, ref value); pointCollection.AddPoint(Utils3D.Create3DPoint(double_3, double_4, zMin), ref value, ref value); pointCollection.AddPoint(Utils3D.Create3DPoint(double_3, double_4, zMax), ref value, ref value); pointCollection.AddPoint(Utils3D.Create3DPoint(double_, double_4, zMin), ref value, ref value); pointCollection.AddPoint(Utils3D.Create3DPoint(double_, double_4, zMax), ref value, ref value); pointCollection.AddPoint(Utils3D.Create3DPoint(double_, double_2, zMin), ref value, ref value); pointCollection.AddPoint(Utils3D.Create3DPoint(double_, double_2, zMax), ref value, ref value); geometryCollection.AddGeometry(pointCollection as IGeometry, ref value, ref value); return(multiPatch); }
public static void MakeConstantZ(IGeometry igeometry_0, double double_0) { if (igeometry_0 is IZ) { Utils3D.MakeZMAware(igeometry_0, true); IZ iZ = igeometry_0 as IZ; iZ.CalculateNonSimpleZs(); iZ.SetConstantZ(double_0); } }
private static IPointCollection ReturnMidPoints(IPointCollection ipointCollection_0) { IPointCollection pointCollection = new Polyline(); object value = Missing.Value; for (int i = 1; i <= ipointCollection_0.PointCount - 2; i++) { IPoint point = ipointCollection_0.get_Point(i); IPoint point2 = ipointCollection_0.get_Point(i + 1); IPath path = new Path() as IPath; Utils3D.MakeZMAware(path, true); path.FromPoint = point; path.ToPoint = point2; IPoint point3 = new Point(); Utils3D.MakeZMAware(point3, true); path.QueryPoint(esriSegmentExtension.esriNoExtension, 0.5, true, point3); point3.Z = (point.Z + point2.Z) / 2.0; pointCollection.AddPoint(Utils3D.CreateClone(point3 as IClone) as IPoint, ref value, ref value); } return(null); }
public static IMultiPatch Cylinder(IPoint ipoint_0, double double_0, double double_1, double double_2, double double_3, double double_4, bool bool_0, bool bool_1) { double num = 36.0; object value = Missing.Value; double num2 = (double_2 - double_1) / num; double num3 = double_2 - double_1; IMultiPatch multiPatch = new MultiPatch() as IMultiPatch; IGeometryCollection geometryCollection = multiPatch as IGeometryCollection; IPointCollection pointCollection = new TriangleStrip(); IVector3D vector3D = new Vector3D() as IVector3D; IEncode3DProperties encode3DProperties = new GeometryEnvironment() as IEncode3DProperties; for (double num4 = double_2; num4 <= double_1; num4 += -num2) { double num5 = Utils3D.DegreesToRadians(num4); vector3D.PolarSet(-num5, 0.0, double_0); IPoint point = new Point(); point.X = ipoint_0.X + vector3D.XComponent; point.Y = ipoint_0.Y + vector3D.YComponent; point.Z = double_3; double num6 = (num4 - double_1) / num3; if (bool_0) { num6 = 1.0 + num6 * -1.0; } if (num6 <= 0.0) { num6 = 0.001; } else if (num6 >= 1.0) { num6 = 0.999; } double textureT; if (bool_1) { textureT = 0.0; } else { textureT = 1.0; } double m = 0.0; encode3DProperties.PackTexture2D(num6, textureT, out m); point.M = m; pointCollection.AddPoint(point, ref value, ref value); IClone clone = point as IClone; IPoint point2 = clone.Clone() as IPoint; point2.Z = double_4; if (bool_1) { textureT = 1.0; } else { textureT = 0.0; } m = 0.0; encode3DProperties.PackTexture2D(num6, textureT, out m); point2.M = m; pointCollection.AddPoint(point2, ref value, ref value); } IGeometry2 inGeometry = pointCollection as IGeometry2; geometryCollection.AddGeometry(inGeometry, ref value, ref value); IZAware iZAware = multiPatch as IZAware; iZAware.ZAware = true; IMAware iMAware = multiPatch as IMAware; iMAware.MAware = true; return(multiPatch); }
public static void SetWin_TOPMOST(int int_0) { Utils3D.SetWindowPos(int_0, -1, 0, 0, 0, 0, 3); }
public static IElement AddSimpleGraphic(IGeometry igeometry_0, IRgbColor irgbColor_0, int int_0, string string_0, object object_0) { IElement element = null; IElement result; if (igeometry_0.IsEmpty) { result = null; } else { esriGeometryType geometryType = igeometry_0.GeometryType; IElement element2; switch (geometryType) { case esriGeometryType.esriGeometryPoint: { element2 = new MarkerElement(); IMarkerElement markerElement = element2 as IMarkerElement; markerElement.Symbol = new SimpleMarkerSymbol { Color = irgbColor_0, Size = (double)int_0, Style = esriSimpleMarkerStyle.esriSMSCircle }; goto IL_132; } case esriGeometryType.esriGeometryMultipoint: break; case esriGeometryType.esriGeometryPolyline: { element2 = new LineElement(); ILineElement lineElement = element2 as ILineElement; lineElement.Symbol = new SimpleLineSymbol { Width = (double)int_0, Color = irgbColor_0, Style = esriSimpleLineStyle.esriSLSSolid }; goto IL_132; } case esriGeometryType.esriGeometryPolygon: { ISimpleLineSymbol simpleLineSymbol = new SimpleLineSymbol(); simpleLineSymbol.Width = (double)int_0; simpleLineSymbol.Color = irgbColor_0; simpleLineSymbol.Style = esriSimpleLineStyle.esriSLSSolid; element2 = new PolygonElement(); IFillShapeElement fillShapeElement = element2 as IFillShapeElement; fillShapeElement.Symbol = new SimpleFillSymbol { Color = irgbColor_0, Outline = simpleLineSymbol }; goto IL_132; } default: if (geometryType == esriGeometryType.esriGeometryMultiPatch) { element2 = new MultiPatchElement(); IFillShapeElement fillShapeElement2 = element2 as IFillShapeElement; IFillSymbol symbol = fillShapeElement2.Symbol; symbol.Color = irgbColor_0; fillShapeElement2.Symbol = symbol; goto IL_132; } break; } result = element; return(result); IL_132: Utils3D.MakeZMAware(igeometry_0, true); element2.Geometry = igeometry_0; IElementProperties elementProperties = element2 as IElementProperties; elementProperties.Name = string_0; if (object_0 is IGraphicsContainer3D) { IGraphicsContainer3D graphicsContainer3D = object_0 as IGraphicsContainer3D; graphicsContainer3D.AddElement(element2); } else if (object_0 is IScenePlugin) { IGraphicsContainer3D graphicsContainer3D2 = (object_0 as IScenePlugin).Scene.BasicGraphicsLayer as IGraphicsContainer3D; graphicsContainer3D2.AddElement(element2); } else if (object_0 is IGroupElement) { IGroupElement groupElement = object_0 as IGroupElement; groupElement.AddElement(element2); } result = element2; } return(result); }