Exemplo n.º 1
0
 public override void imethod_10(
     EntityColor color,
     Transparency transparency,
     bool isColorBookColor)
 {
     this.imethod_6(Color.CreateFrom(color));
 }
Exemplo n.º 2
0
 public void imethod_26(
     out EntityColor color,
     out Transparency transparency,
     out bool isColorBookColor)
 {
     this.interface30_0.imethod_26(out color, out transparency, out isColorBookColor);
 }
Exemplo n.º 3
0
 protected DrawContext(DrawContext from)
 {
     this.image_0               = from.image_0;
     this.graphics_0            = from.graphics_0;
     this.dxfModel_0            = from.dxfModel_0;
     this.dxfLayout_0           = from.dxfLayout_0;
     this.graphicsConfig_0      = from.graphicsConfig_0;
     this.dxfLayer_0            = from.dxfLayer_0;
     this.dxfLayer_1            = from.dxfLayer_1;
     this.dxfEntity_0           = from.dxfEntity_0;
     this.dxfBlock_0            = from.dxfBlock_0;
     this.drawContext_0         = from.drawContext_0;
     this.dxfEntity_1           = from.dxfEntity_1;
     this.entityColor_0         = from.entityColor_0;
     this.transparency_0        = from.transparency_0;
     this.dxfColor_0            = from.dxfColor_0;
     this.dxfLineType_0         = from.dxfLineType_0;
     this.short_0               = from.short_0;
     this.int_0                 = from.int_0;
     this.int_1                 = from.int_1;
     this.dxfWipeoutVariables_0 = from.dxfWipeoutVariables_0;
     this.dictionary_0          = from.dictionary_0;
     this.double_0              = from.double_0;
     this.double_1              = from.double_1;
 }
Exemplo n.º 4
0
        public void DrawString(string s, Font font, Brush brush, PointF point)
        {
            DxfText dxfText = new DxfText(s, new WW.Math.Point3D((double)point.X, -(double)point.Y, 0.0), (double)font.Size);

            dxfText.AlignmentPoint2   = new WW.Math.Point3D?(dxfText.AlignmentPoint1);
            dxfText.VerticalAlignment = TextVerticalAlignment.Top;
            DxfTextStyle dxfTextStyle = (DxfTextStyle)null;

            foreach (DxfTextStyle textStyle in (DxfHandledObjectCollection <DxfTextStyle>) this.dxfModel_0.TextStyles)
            {
                if (textStyle.FontFilename == font.Name)
                {
                    dxfTextStyle = textStyle;
                    break;
                }
            }
            if (dxfTextStyle == null)
            {
                dxfTextStyle = new DxfTextStyle(font.Name, font.Name);
                this.dxfModel_0.TextStyles.Add(dxfTextStyle);
            }
            dxfText.Style = dxfTextStyle;
            SolidBrush solidBrush = brush as SolidBrush;

            if (solidBrush != null)
            {
                dxfText.Color = EntityColor.CreateFrom((ArgbColor)solidBrush.Color);
            }
            this.list_0.Add((DxfEntity)dxfText);
        }
Exemplo n.º 5
0
        //纹理测试
        static private void createMaterial(Database db, Transaction myT)
        {
            DBDictionary dic =
                (DBDictionary)myT.GetObject(db.MaterialDictionaryId, OpenMode.ForWrite, false);

            ImageFileTexture imfttr = new ImageFileTexture();

            imfttr.SourceFileName = @"D:\Geological Project\Geological Source\dbFiles\aaaaa.jpg";

            double uScale  = 1.0;
            double vScale  = 1.0;
            double uOffset = 0;
            double vOffset = 0;

            double[] p = new double[] {
                uScale, 0, 0, uScale *uOffset,
                0, vScale, 0, vScale *vOffset,
                0, 0, 1, 0,
                0, 0, 0, 1
            };

            Matrix3d mx = new Matrix3d(p);

            Mapper mapper = new Mapper(Projection.Planar, Tiling.Crop, Tiling.Crop,
                                       AutoTransform.TransformObject, mx);

            MaterialMap map = new MaterialMap(Source.File, imfttr, 1, mapper);


            EntityColor              eclr = new EntityColor(150, 150, 150);
            MaterialColor            mc   = new MaterialColor(Method.Override, 1, eclr);
            MaterialDiffuseComponent mdc  = new MaterialDiffuseComponent(mc, map);

            MaterialSpecularComponent   mck  = new MaterialSpecularComponent(mc, map, 0.5);
            MaterialOpacityComponent    moc  = new MaterialOpacityComponent(1, map);
            MaterialRefractionComponent mrfr = new MaterialRefractionComponent(2, map);

            Material Mat = new Material();

            Mat.Name             = "My Material";
            Mat.Description      = "New Material";
            Mat.Diffuse          = mdc;
            Mat.Specular         = mck;
            Mat.Refraction       = mrfr;
            Mat.Reflectivity     = 1;
            Mat.Reflection       = map;
            Mat.Opacity          = moc;
            Mat.Ambient          = mc;
            Mat.Bump             = map;
            Mat.SelfIllumination = 1;


            // MaterialDiffuseComponent diffuseColor = new MaterialDiffuseComponent(color, map);
            // material.Diffuse = diffuseColor;

            // material.Mode = Mode.Realistic;

            dic.SetAt(Mat.Name, Mat);
        }
Exemplo n.º 6
0
        public override bool WorldDraw(Drawable d, WorldDraw wd)
        {
            double radius = 0.0;

            if (d is DBObject)
            {
                radius = PipeRadiusForObject((DBObject)d);
            }

            if (radius > 0.0)
            {
                Line line = d as Line;

                if (line != null)
                {
                    // Draw the line as is, with overruled attributes

                    base.WorldDraw(line, wd);
                    if (!line.Id.IsNull && line.Length > 0.0)
                    {
                        // Draw a pipe around the line

                        EntityColor c =
                            wd.SubEntityTraits.TrueColor;
                        wd.SubEntityTraits.TrueColor =
                            new EntityColor(0x00AfAfff);
                        wd.SubEntityTraits.LineWeight =
                            LineWeight.LineWeight000;
                        Circle clr =
                            new Circle(
                                line.StartPoint,
                                line.EndPoint - line.StartPoint,
                                radius
                                );
                        ExtrudedSurface pipe = new ExtrudedSurface();
                        try
                        {
                            pipe.CreateExtrudedSurface(
                                clr, line.EndPoint - line.StartPoint, sweepOpts
                                );
                        }
                        catch
                        {
                            Document doc =
                                Application.DocumentManager.MdiActiveDocument;
                            doc.Editor.WriteMessage(
                                "\nFailed with CreateExtrudedSurface."
                                );
                        }
                        clr.Dispose();
                        pipe.WorldDraw(wd);
                        pipe.Dispose();
                        wd.SubEntityTraits.TrueColor = c;
                    }
                    return(true);
                }
            }
            return(base.WorldDraw(d, wd));
        }
Exemplo n.º 7
0
 public bool Matches(DxfLayer layer, EntityColor byBlockColor, DxfLineType byBlockLineType)
 {
     if (this.graphicElementBlock2_0 == null)
     {
         return(false);
     }
     return(this.graphicElementBlock2_0.Matches(layer, byBlockColor, byBlockLineType));
 }
Exemplo n.º 8
0
 public TraitsState(SubEntityTraits subEntityTraits)
 {
     _subEntityTraits = subEntityTraits;
     _entColor        = subEntityTraits.TrueColor;
     _transparency    = subEntityTraits.Transparency;
     _visualStyle     = subEntityTraits.VisualStyle;
     _selectionFlags  = subEntityTraits.SelectionFlags;
 }
Exemplo n.º 9
0
 public bool Matches(DxfLayer layer, EntityColor byBlockColor, DxfLineType byBlockLineType)
 {
     if (layer.Enabled == this.bool_0 && layer.Frozen == this.bool_1 && (layer.Color.ToArgb() == this.color_0.ToArgb() && layer.LineType == this.ByLayerLineType && byBlockColor.ToArgb() == this.entityColor_0.ToArgb()))
     {
         return(byBlockLineType == this.ByBlockLineType);
     }
     return(false);
 }
Exemplo n.º 10
0
 public bool Matches(Color byLayerColor, EntityColor byBlockColor)
 {
     if (byLayerColor.ToArgb() == this.color_0.ToArgb())
     {
         return(byBlockColor.ToArgb() == this.entityColor_0.ToArgb());
     }
     return(false);
 }
Exemplo n.º 11
0
        public override void imethod_26(
            out EntityColor color,
            out Transparency transparency,
            out bool isColorBookColor)
        {
            isColorBookColor = false;
            short colorNumber = this.imethod_14();

            transparency = Transparency.ByLayer;
            color        = DxfIndexedColorSet.GetEntityColor(colorNumber);
        }
Exemplo n.º 12
0
 void Start()
 {
     charSlot     = GetComponentInParent <CharSlot>();
     entityColor  = GetComponentInChildren <EntityColor>();
     charAnimator = GetComponent <CharAnimator>();
     type         = tag;
     vidaAtual    = vidaMax;
     SetupUIBar();
     KillCount     = 0;
     LastKillCount = 0;
 }
Exemplo n.º 13
0
        public IPlotStyle GetPlotStyle(
            IPlotPropertyOwner plotPropertyOwner,
            DrawContext drawContext)
        {
            EntityColor entityColor = plotPropertyOwner.GetEntityColor(drawContext);

            if (entityColor.ColorType == ColorType.ByColorIndex && entityColor.ToArgbColor() == this.argbColor_0)
            {
                return((IPlotStyle) new OverrideColorPlotStyle(this.argbColor_1, plotPropertyOwner, drawContext));
            }
            return((IPlotStyle) new DefaultPlotStyle(plotPropertyOwner, drawContext));
        }
    private static ObjectId AddMaterial(string nameWood)
    {
        //
        Database           db    = Application.DocumentManager.MdiActiveDocument.Database;
        TransactionManager tm    = db.TransactionManager;
        Transaction        trans = tm.StartTransaction();
        Editor             ed    = Application.DocumentManager.MdiActiveDocument.Editor;

        ObjectId materialId = ObjectId.Null;

        try
        {
            DBDictionary materialDict;

            ObjectId materialDictId = db.MaterialDictionaryId;

            materialDict = trans.GetObject(materialDictId, OpenMode.ForWrite) as DBDictionary;

            Material material = new Material();
            material.Name = nameWood;

            WoodTexture   woodTexture = new WoodTexture();
            MaterialColor matColor, woodColor1, woodColor2;

            EntityColor entColor = new EntityColor(128, 0, 128);
            matColor = new MaterialColor(Method.Override, 1.0, entColor);
            EntityColor entColor2 = new EntityColor(128, 128, 0);
            woodColor1 = new MaterialColor(Method.Override, 1.0, entColor2);
            EntityColor entColor3 = new EntityColor(0, 128, 128);
            woodColor2 = new MaterialColor(Method.Override, 1.0, entColor3);

            woodTexture.Color1 = woodColor1;
            woodTexture.Color2 = woodColor2;
            MaterialMap materialMap = new MaterialMap(Source.Procedural, woodTexture, 0, null);

            material.Diffuse = new MaterialDiffuseComponent(matColor, materialMap);

            MaterialColor inheritColor = new MaterialColor(Method.Inherit, 1.0, entColor);
            material.Ambient  = matColor;
            material.Specular = new MaterialSpecularComponent(matColor, new MaterialMap(), 0.5);
            material.Mode     = Mode.Realistic;

            materialDict.SetAt(nameWood, material);
            materialId = material.ObjectId;
            trans.Commit();
        }
        catch (System.Exception e)
        {
            ed.WriteMessage(e.Message);
            trans.Abort();
        }
        return(materialId);
    }
Exemplo n.º 15
0
 public GraphicElementBlock1 GetGraphicElementBlock(
     Color byLayerColor,
     EntityColor byBlockColor)
 {
     foreach (GraphicElementBlock1 graphicElementBlock1 in this.list_0)
     {
         if (graphicElementBlock1.Matches(byLayerColor, byBlockColor))
         {
             return(graphicElementBlock1);
         }
     }
     return((GraphicElementBlock1)null);
 }
Exemplo n.º 16
0
 public Class1001(
     DxfEntity entity,
     Color byLayerColor,
     DxfLineType byLayerLineType,
     EntityColor byBlockColor,
     DxfLineType byBlockLineType)
 {
     this.dxfEntity_0   = entity;
     this.color_0       = byLayerColor;
     this.dxfLineType_0 = byLayerLineType;
     this.entityColor_0 = byBlockColor;
     this.dxfLineType_1 = byBlockLineType;
 }
        public static System.Windows.Media.Color ColorIndexToMediaColor(int cla)
        {
            if (cla == 7)
            {
                return(System.Windows.Media.Color.FromArgb(255, 255, 255, 255));
            }

            var acirgb = EntityColor.LookUpRgb((byte)cla);
            var b      = (byte)acirgb;
            var g      = (byte)(acirgb >> 8);
            var r      = (byte)(acirgb >> 16);

            return(System.Windows.Media.Color.FromRgb(r, g, b));
        }
Exemplo n.º 18
0
 public GraphicElementBlock2 GetGraphicElementBlock(
     DxfLayer layer,
     EntityColor byBlockColor,
     DxfLineType byBlockLineType)
 {
     foreach (GraphicElementBlock2 graphicElementBlock2 in this.list_0)
     {
         if (graphicElementBlock2.Matches(layer, byBlockColor, byBlockLineType))
         {
             return(graphicElementBlock2);
         }
     }
     return((GraphicElementBlock2)null);
 }
Exemplo n.º 19
0
        public static SolidBrush GetSolidBrush(string color)
        {
            EntityColor ec = EntityColor.red;

            Enum.TryParse <EntityColor>(color, out ec);
            if ((int)ec == 0)
            {
                ec = EntityColor.red;
            }
            Color      c  = GetEntityColor(ec);
            SolidBrush br = new SolidBrush(c);

            return(br);
        }
Exemplo n.º 20
0
        public override bool WorldDraw(Drawable d, WorldDraw wd)
        {
            double radius = 0.0;

            if (d is DBObject)
            {
                radius = PipeRadiusForObject((DBObject)d);
            }

            if (radius > 0.0)
            {
                Circle circle = d as Circle;

                if (circle != null)
                {
                    // Draw the circle as is, with overruled attributes

                    base.WorldDraw(circle, wd);

                    // Needed to avoid ill-formed swept surface

                    if (circle.Radius > radius)
                    {
                        // Draw a pipe around the cirle

                        EntityColor c = wd.SubEntityTraits.TrueColor;
                        wd.SubEntityTraits.TrueColor =
                            new EntityColor(0x3fffe0e0);
                        wd.SubEntityTraits.LineWeight =
                            LineWeight.LineWeight000;
                        Vector3d normal =
                            (circle.Center - circle.StartPoint).
                            CrossProduct(circle.Normal);
                        Circle clr =
                            new Circle(
                                circle.StartPoint, normal, radius
                                );
                        SweptSurface pipe = new SweptSurface();
                        pipe.CreateSweptSurface(clr, circle, sweepOpts);
                        clr.Dispose();
                        pipe.WorldDraw(wd);
                        pipe.Dispose();
                        wd.SubEntityTraits.TrueColor = c;
                    }
                    return(true);
                }
            }
            return(base.WorldDraw(d, wd));
        }
Exemplo n.º 21
0
 public GraphicElementInsert GetGraphicElementInsert(
     DxfLayer layer,
     EntityColor byBlockColor,
     DxfLineType byBlockLineType)
 {
     foreach (IGraphicElement graphicElement in this.list_0)
     {
         GraphicElementInsert graphicElementInsert = graphicElement as GraphicElementInsert;
         if (graphicElementInsert != null && graphicElementInsert.Matches(layer, byBlockColor, byBlockLineType))
         {
             return(graphicElementInsert);
         }
     }
     return((GraphicElementInsert)null);
 }
Exemplo n.º 22
0
        /// <summary>
        /// Get current layer color.
        /// </summary>
        /// <param name="doc">Current document</param>
        /// <returns>layer color</returns>
        public static EntityColor GetCurrentLayerColor(Database db)
        {
            if (db == null)
            {
                throw new ArgumentNullException(/*MSG0*/ "db");
            }

            using (Transaction tran = db.TransactionManager.StartTransaction())
            {
                var         existedLayerTableRecord = (LayerTableRecord)tran.GetObject(db.Clayer, OpenMode.ForRead, false);
                EntityColor entityColor             = existedLayerTableRecord.Color.EntityColor;
                tran.Commit();

                return(entityColor);
            }
        }
Exemplo n.º 23
0
 public GraphicElementBlock2(
     Matrix4D transform,
     DxfLayer layer,
     EntityColor byBlockColor,
     DxfLineType byBlockLineType)
 {
     this.matrix4D_0       = transform;
     this.bool_0           = layer.Enabled;
     this.bool_1           = layer.Frozen;
     this.color_0          = layer.Color;
     this.dxfLineType_0    = layer.LineType;
     this.entityColor_0    = byBlockColor;
     this.dxfLineType_1    = byBlockLineType;
     this.linkedListNode_0 = this.linkedList_0.AddLast((IGraphicElement)NullGraphicElement.Instance);
     this.linkedList_0.AddLast((IGraphicElement)NullGraphicElement.Instance);
 }
Exemplo n.º 24
0
        /// <summary>
        ///     TODO
        /// </summary>
        /// <param name="color"></param>
        /// <returns></returns>
        private System.Drawing.Color AcadColorAciToDrawingColor(Color color)
        {
            var aci  = Convert.ToByte(color.ColorIndex);
            var aRgb = EntityColor.LookUpRgb(aci);
            var ch   = BitConverter.GetBytes(aRgb);

            if (!BitConverter.IsLittleEndian)
            {
                Array.Reverse(ch);
            }
            int r = ch[2];
            int g = ch[1];
            int b = ch[0];

            return(System.Drawing.Color.FromArgb(r, g, b));
        }
Exemplo n.º 25
0
        public void init(LayoutHelperDevice pDevice, Model gsModule, Database pDb /* OdDbCommandContext ctx*/)
        {
            m_pDevice  = pDevice;
            m_pGsModel = gsModule;

            //pDb->addReactor(&m_cDbReactor);

            HostApplicationServices pAppSvcs = HostApplicationServices.Current;

            m_GRIPSIZE     = pAppSvcs.GRIPSIZE;
            m_GRIPOBJLIMIT = pAppSvcs.GRIPOBJLIMIT;
            m_GRIPCOLOR    = new EntityColor(ColorMethod.ByAci, pAppSvcs.GRIPCOLOR);
            m_GRIPHOVER    = new EntityColor(ColorMethod.ByAci, pAppSvcs.GRIPHOVER);
            m_GRIPHOT      = new EntityColor(ColorMethod.ByAci, pAppSvcs.GRIPHOT);

            //m_pGetSelectionSetPtr = pGetSSet;
        }
Exemplo n.º 26
0
 public override void imethod_10(
     EntityColor color,
     Transparency transparency,
     bool isColorBookColor)
 {
     if (color == EntityColor.ByBlock && !isColorBookColor)
     {
         this.imethod_32((short)0);
     }
     else
     {
         ushort num = 0;
         bool   flag;
         if (flag = transparency.TransparencyType != TransparencyType.ByLayer)
         {
             num |= (ushort)8192;
         }
         if (isColorBookColor)
         {
             this.imethod_32((short)(ushort)((uint)num | 49152U));
         }
         else if (color == EntityColor.ByLayer)
         {
             this.imethod_32((short)(ushort)((uint)num | 256U));
         }
         else if (color.ColorType == ColorType.ByColorIndex)
         {
             this.imethod_32((short)(ushort)((uint)num | (uint)(ushort)color.ColorIndex));
         }
         else
         {
             int colorDifference;
             int colorIndex = (int)DxfIndexedColorSet.GetColorIndex(color.ToArgbColor(), out colorDifference);
             this.imethod_32((short)(ushort)((uint)num | (uint)(ushort)(32768 | colorIndex)));
             this.imethod_33((int)color.Data);
         }
         if (!flag)
         {
             return;
         }
         this.imethod_33((int)transparency.Data);
     }
 }
Exemplo n.º 27
0
        public static Color GetEntityColor(EntityColor color)
        {
            Color c = Color.Red;

            switch (color)
            {
            case EntityColor.red:
                c = Color.Red;
                break;

            case EntityColor.green:
                c = Color.Green;
                break;

            case EntityColor.blue:
                c = Color.Blue;
                break;
            }
            return(c);
        }
Exemplo n.º 28
0
        public DxfHatch getHatch_Deck(decimal percentfill, double[] x, double[] y, EntityColor hatchcolor)
        {
            DxfHatch hatch = new DxfHatch();

            hatch.Color = hatchcolor;

            if (percentfill != 0)
            {
                #region hatch
                DxfHatch.BoundaryPath.Polyline.Vertex[] Ver = new DxfHatch.BoundaryPath.Polyline.Vertex[13];

                if ((Convert.ToInt32(percentfill) > 0) & (Convert.ToInt32(percentfill) <= 100))
                {
                    for (int i = 1; i <= 12; i++)
                    {
                        Ver[i] = new DxfHatch.BoundaryPath.Polyline.Vertex(x[i], y[i]);
                    }
                }

                DxfHatch.BoundaryPath bp = new DxfHatch.BoundaryPath();
                bp.Type = BoundaryPathType.Polyline;
                hatch.BoundaryPaths.Add(bp);


                bp.PolylineData =
                    new DxfHatch.BoundaryPath.Polyline(
                        new DxfHatch.BoundaryPath.Polyline.Vertex[] {
                    Ver[1], Ver[2], Ver[3], Ver[4], Ver[5], Ver[6], Ver[7], Ver[8], Ver[9], Ver[10], Ver[11], Ver[12]
                }

                        );


                bp.PolylineData.Closed = true;

                #endregion hatch
            }

            return(hatch);
        }
Exemplo n.º 29
0
        public override void imethod_26(
            out EntityColor color,
            out Transparency transparency,
            out bool isColorBookColor)
        {
            isColorBookColor = false;
            short num1 = this.imethod_14();

            if (num1 == (short)0)
            {
                color        = EntityColor.ByBlock;
                transparency = Transparency.Opaque;
            }
            else
            {
                ushort num2 = (ushort)((uint)(ushort)num1 & 65280U);
                if (((int)num2 & 16384) != 0)
                {
                    color            = EntityColors.ByBlock;
                    isColorBookColor = true;
                }
                else if (((int)num2 & 32768) != 0)
                {
                    int num3 = this.imethod_11();
                    color = EntityColor.CreateFromRgb(num3 & 16777215);
                }
                else
                {
                    color = DxfIndexedColorSet.GetEntityColor((short)((int)num1 & 4095));
                }
                if (((int)num2 & 8192) != 0)
                {
                    transparency = new Transparency((uint)this.imethod_11());
                }
                else
                {
                    transparency = Transparency.ByLayer;
                }
            }
        }
Exemplo n.º 30
0
        public bool GetGraphicElementInsert(
            IGraphicElementBlock graphicElementBlock,
            DxfEntity insert,
            DxfLayer layer,
            EntityColor byBlockColor,
            DxfLineType byBlockLineType,
            out GraphicElementInsert graphicElement)
        {
            Graphics.EntityInfo entityInfo;
            bool flag;

            if (this.dictionary_0.TryGetValue(insert, out entityInfo))
            {
                graphicElement = entityInfo.GetGraphicElementInsert(layer, byBlockColor, byBlockLineType);
                if (graphicElement == null)
                {
                    flag           = true;
                    graphicElement = new GraphicElementInsert();
                    entityInfo.GraphicElements.Add((IGraphicElement)graphicElement);
                }
                else
                {
                    flag = false;
                }
            }
            else
            {
                graphicElement = new GraphicElementInsert();
                this.dictionary_0.Add(insert, new Graphics.EntityInfo()
                {
                    GraphicElements =
                    {
                        (IGraphicElement)graphicElement
                    }
                });
                flag = true;
            }
            graphicElementBlock.Add((IGraphicElement)graphicElement);
            return(flag);
        }