Ejemplo n.º 1
0
 public cShapeOutline(ShapeTypes stNewShapeType, List<Point> plNewShapeCoordinates, Color cNewShapeColor)
 {
     stShapeType = stNewShapeType;
     plShapeCoordinates = new List<Point>(plNewShapeCoordinates);
     cShapeColor = cNewShapeColor;
     sText = "Error";
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Create legend scheme from grid data
        /// </summary>
        /// <param name="aGridData">GridData</param>
        /// <param name="aLT">legend type</param>
        /// <param name="aST">shape type</param>
        /// <param name="hasNoData">ref if has undefine data</param>
        /// <returns>legend scheme</returns>
        public static LegendScheme CreateLegendSchemeFromGridData(GridData aGridData,
                                                                  LegendType aLT, ShapeTypes aST, ref Boolean hasNoData)
        {
            LegendScheme aLS = new LegendScheme(aST);

            double[] CValues;
            Color[]  colors;
            double   MinData = 0;
            double   MaxData = 0;

            hasNoData = ContourDraw.GetMaxMinValue(aGridData.Data, aGridData.MissingValue, ref MinData, ref MaxData);
            CValues   = CreateContourValues(MinData, MaxData);
            colors    = CreateRainBowColors(CValues.Length + 1);

            //Generate lengendscheme
            if (aLT == LegendType.UniqueValue)
            {
                aLS = CreateUniqValueLegendScheme(CValues, colors,
                                                  aST, MinData, MaxData, hasNoData, aGridData.MissingValue);
            }
            else
            {
                aLS = CreateGraduatedLegendScheme(CValues, colors,
                                                  aST, MinData, MaxData, hasNoData, aGridData.MissingValue);
            }

            return(aLS);
        }
Ejemplo n.º 3
0
        public static AbstractDetailsBase CreatShape(ShapeTypes shape)
        {
            Type     type     = null;
            Assembly assembly = Assembly.Load(DllName);

            switch (shape)
            {
            case ShapeTypes.Line:
                type = assembly.GetType(LineTypeName);
                break;

            case ShapeTypes.Circle:
                type = assembly.GetType(CircleTypeName);
                break;

            case ShapeTypes.Arc:
                type = assembly.GetType(ArcTypeName);
                break;

            case ShapeTypes.PLine:
                type = assembly.GetType(PLineTypeName);
                break;
            }
            AbstractDetailsBase aShape = Activator.CreateInstance(type) as AbstractDetailsBase;

            return(aShape);
        }
Ejemplo n.º 4
0
        public static IShape GetShape(ShapeTypes shapeType)
        {
            switch (shapeType)
            {
            case ShapeTypes.SimpleRectangle:
                return(new SimpleRectangle());

            case ShapeTypes.SimpleEllipse:
                return(new SimpleEllipse());

            case ShapeTypes.TextLabel:
                return(new TextLabel());

            case ShapeTypes.ClassShape:
                return(new ClassShape());

            case ShapeTypes.TextOnly:
                return(new TextOnly());

            case ShapeTypes.ImageShape:
                return(new ImageShape());

            case ShapeTypes.DecisionShape:
                break;

            default:
                return(null);
            }

            return(null);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Adds a predefined shape
        /// </summary>
        /// <param name="type"></param>
        /// <param name="location"></param>
        public ShapeBase AddShape(ShapeTypes type, Point location)
        {
            ShapeBase shape = null;

            switch (type)
            {
            case ShapeTypes.Rectangular:
                shape = new SimpleRectangle(this);
                break;

            case ShapeTypes.Oval:
                shape = new OvalShape(this);
                break;

            case ShapeTypes.TextLabel:
                shape            = new TextLabel(this);
                shape.Location   = location;
                shape.ShapeColor = Color.Transparent;
                shape.Text       = "A text label (change the text in the property grid)";
                shape.Width      = 350;
                shape.Height     = 30;
                Shapes.Add(shape);
                return(shape);
            }
            if (shape == null)
            {
                return(null);
            }
            shape.ShapeColor = Color.FromArgb(rnd.Next(0, 255), rnd.Next(0, 255), rnd.Next(0, 255));
            shape.Location   = location;
            Shapes.Add(shape);
            return(shape);
        }
Ejemplo n.º 6
0
        public static BaseShape CreateShape(Texture2D blockTexture, Board board, ShapeTypes shapeType)
        {
            switch (shapeType)
            {
            case ShapeTypes.I:
                return(new IShape(blockTexture, board));

            case ShapeTypes.J:
                return(new JShape(blockTexture, board));

            case ShapeTypes.L:
                return(new LShape(blockTexture, board));

            case ShapeTypes.O:
                return(new OShape(blockTexture, board));

            case ShapeTypes.S:
                return(new SShape(blockTexture, board));

            case ShapeTypes.T:
                return(new TShape(blockTexture, board));

            case ShapeTypes.Z:
                return(new ZShape(blockTexture, board));

            default:
                return(null);
            }
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Import legend scheme from XML node
        /// </summary>
        /// <param name="LSNode">xml node</param>
        /// <param name="keepShape">if keep the legend shape type</param>
        public void ImportFromXML(XmlNode LSNode, bool keepShape)
        {
            LegendBreaks = new List <ColorBreak>();

            if (!(LSNode.Attributes["FieldName"] == null))
            {
                FieldName = LSNode.Attributes["FieldName"].InnerText;
            }
            LegendType = (LegendType)Enum.Parse(typeof(LegendType),
                                                LSNode.Attributes["LegendType"].InnerText, true);
            ShapeTypes aShapeType = (ShapeTypes)Enum.Parse(typeof(ShapeTypes),
                                                           LSNode.Attributes["ShapeType"].InnerText, true);

            //BreakNum = Convert.ToInt32(LSNode.Attributes["BreakNum"].InnerText);
            HasNoData    = Convert.ToBoolean(LSNode.Attributes["HasNoData"].InnerText);
            MinValue     = Convert.ToDouble(LSNode.Attributes["MinValue"].InnerText);
            MaxValue     = Convert.ToDouble(LSNode.Attributes["MaxValue"].InnerText);
            MissingValue = Convert.ToDouble(LSNode.Attributes["UNDEF"].InnerText);

            if (!keepShape)
            {
                ShapeType = aShapeType;
            }
            bool sameShapeType = (ShapeType == aShapeType);

            ImportBreaks(LSNode, sameShapeType);
        }
        public static string Dump(ShapeTypes value)
        {
            var assistant = new AssistantDumper();

            Dump(assistant, value);
            return(assistant.ToString());
        }
        internal static void Dump(AssistantDumper assistant, ShapeTypes value, bool withSeparator = false)
        {
            assistant.IncrementDepth();
            if (assistant.MaximumDepthExceeded())
                return;

            assistant.AddStartObject();
            assistant.AddType("Dogen.TestModels.CSharpModel.Package1.ShapeTypes", true/*withSeparator*/);
            string valueAsString = "Unsupported Value";
            switch (value)
            {
                case ShapeTypes.Invalid:
                    valueAsString = "Invalid";
                    break;
                case ShapeTypes.Triangle:
                    valueAsString = "Triangle";
                    break;
                case ShapeTypes.Square:
                    valueAsString = "Square";
                    break;
                case ShapeTypes.Rectangle:
                    valueAsString = "Rectangle";
                    break;
                case ShapeTypes.Cube:
                    valueAsString = "Cube";
                    break;
            }

            assistant.Add("value", valueAsString);
            assistant.AddEndObject();

            assistant.DecrementDepth();
        }
Ejemplo n.º 10
0
        private static int GetContentLength(object aShape, ShapeTypes aST)
        {
            int contentLength = 0;

            switch (aST)
            {
            case ShapeTypes.Point:
                contentLength = 2 + 4 * 2;
                break;

            case ShapeTypes.Polyline:
                PolylineShape aPLS = (PolylineShape)aShape;
                contentLength = 2 + 4 * 4 + 2 + 2 + 2 * aPLS.PartNum + 4 * 2 * aPLS.PointNum;
                break;

            case ShapeTypes.PolylineZ:
                PolylineZShape aPLZS = (PolylineZShape)aShape;
                contentLength = 2 + 4 * 4 + 2 + 2 + 2 * aPLZS.PartNum + 4 * 2 * aPLZS.PointNum +
                                4 + 4 + 4 * aPLZS.PointNum + 4 + 4 + 4 * aPLZS.PointNum;
                break;

            case ShapeTypes.Polygon:
                PolygonShape aPGS = (PolygonShape)aShape;
                contentLength = 2 + 4 * 4 + 2 + 2 + 2 * aPGS.PartNum + 4 * 2 * aPGS.PointNum;
                break;
            }

            return(contentLength);
        }
Ejemplo n.º 11
0
 private bool GetUsesShell(ShapeTypes shapeType)
 {
     if (((shapeType != ShapeTypes.HemiSphereShell) && (shapeType != ShapeTypes.SphereShell)) && (((shapeType != ShapeTypes.ConeShell) && (shapeType != ShapeTypes.ConeVolumeShell)) && (shapeType != ShapeTypes.CircleEdge)))
     {
         return false;
     }
     return true;
 }
Ejemplo n.º 12
0
 /// <summary>Constructs the shape.</summary>
 /// <param name="shapeType">The shape type.</param>
 /// <param name="color">The color.</param>
 /// <param name="rounding">The rounding.</param>
 /// <param name="thickness">The thickness.</param>
 /// <param name="visible">The visibility.</param>
 private void ConstructShape(ShapeTypes shapeType, Color color, int rounding, int thickness, bool visible)
 {
     _color     = color;
     _rounding  = rounding;
     _thickness = thickness;
     _shapeType = shapeType;
     _visible   = visible;
 }
Ejemplo n.º 13
0
 private bool GetUsesShell(ShapeTypes shapeType)
 {
     if (((shapeType != ShapeTypes.HemiSphereShell) && (shapeType != ShapeTypes.SphereShell)) && (((shapeType != ShapeTypes.ConeShell) && (shapeType != ShapeTypes.ConeVolumeShell)) && (shapeType != ShapeTypes.CircleEdge)))
     {
         return(false);
     }
     return(true);
 }
Ejemplo n.º 14
0
 public cShapeOutline(string sNewText, Point pLocation, Color cNewShapeColor)
 {
     stShapeType = ShapeTypes.Text;
     plShapeCoordinates = new List<Point>();
     plShapeCoordinates.Add(pLocation);
     cShapeColor = cNewShapeColor;
     sText = sNewText;
 }
Ejemplo n.º 15
0
 public static void AddShape(Connectable shape, ShapeTypes type)
 {
     if (shape == null)
         throw new ArgumentNullException("A null cannot be added to the shape collection.");
     //the undo trick
     AddShapeCommand cmd = new AddShapeCommand(shape, type, Canvas);
     UndoManager.Execute(cmd);
     RaiseOnShapeAdded(shape);
 }
Ejemplo n.º 16
0
        public Shapefile(string filename)
        {
            FileStream   fs = new FileStream(filename, FileMode.Open);
            BinaryReader br = new BinaryReader(fs);

            //读取文件头
            fileCode = ReverseByte(br.ReadInt32());
            for (int i = 1; i <= 5; i++)
            {
                br.ReadInt32();
            }
            fileLength  = ReverseByte(br.ReadInt32()) * 2;
            version     = br.ReadInt32();
            shapeTypeID = br.ReadInt32();
            xmin        = br.ReadDouble();
            ymin        = br.ReadDouble();
            xmax        = br.ReadDouble();
            ymax        = br.ReadDouble();
            zmin        = br.ReadDouble();
            zmax        = br.ReadDouble();
            mmin        = br.ReadDouble();
            mmax        = br.ReadDouble();
            byteCount  += 100;

            switch (shapeTypeID)
            {
            case 1:
            {
                shapeType = ShapeTypes.Point;
                feature   = ReadPointShp(br);
                break;
            }

            case 3:
            {
                shapeType = ShapeTypes.Polyline;
                feature   = ReadPolyLineShp(br);
                break;
            }

            case 5:
            {
                shapeType = ShapeTypes.Polygon;
                feature   = ReadPolygonShp(br);
                break;
            }

            default:
            {
                shapeType = ShapeTypes.NullShape;
                feature   = new FeatureClass();
                break;
            }
            }
        }
Ejemplo n.º 17
0
 /// <summary>
 /// 初始化对象
 /// </summary>
 /// <param name="rect">矩形对象</param>
 /// <param name="type">图形类型</param>
 /// <param name="BorderColor">边框色</param>
 /// <param name="FillColor">背景色</param>
 public ShapeDrawer(
     System.Drawing.RectangleF rect,
     ShapeTypes type,
     System.Drawing.Color BorderColor,
     System.Drawing.Color FillColor)
 {
     this.myBounds    = rect;
     this.intType     = type;
     this.myBorderPen = new Pen(BorderColor);
     this.myFillBrush = new SolidBrush(FillColor);
 }
Ejemplo n.º 18
0
 public HMIIndicator()
 {
     this.TextRect       = new Rectangle();
     this.m_Color1       = Color.DarkGray;
     this.m_Color2       = Color.Green;
     this.m_Color3       = Color.Red;
     this._OutlineColor  = Color.Transparent;
     this.m_OutlineWidth = 1;
     this.m_Shape        = ShapeTypes.Round;
     this.sf             = new StringFormat();
 }
Ejemplo n.º 19
0
        public static void AddShape(Connectable shape, ShapeTypes type)
        {
            if (shape == null)
            {
                throw new ArgumentNullException("A null cannot be added to the shape collection.");
            }
            //the undo trick
            AddShapeCommand cmd = new AddShapeCommand(shape, type, Canvas);

            UndoManager.Execute(cmd);
            RaiseOnShapeAdded(shape);
        }
Ejemplo n.º 20
0
        public static List <Shadow> LookupShadowsByShapeType(ShapeTypes shapeType)
        {
            List <Shadow> list = new List <Shadow>();

            foreach (Shadow shadow in shadowShapeMap.Values)
            {
                if (shadow.GetShapeType() == shapeType)
                {
                    list.Add(shadow);
                }
            }
            return(list);
        }
Ejemplo n.º 21
0
        public Shape CreateShape(ShapeTypes shapeType)
        {
            switch (shapeType)
            {
            case ShapeTypes.Rectangle: return(new Rectangle());

            case ShapeTypes.Square:    return(new Square());

            case ShapeTypes.Circle:    return(new Circle());

            default: throw new Exception("invalid shapeType");
            }
        }
        /// <summary>
        /// Q: Is this method being an static an issue?
        /// </summary>
        /// <param name="shape"></param>
        /// <returns></returns>
        public static IShape Create(ShapeTypes shape)
        {
            switch (shape)
            {
            case ShapeTypes.Circle: return(new Circle());

            case ShapeTypes.Square: return(new Square());

            case ShapeTypes.Pentagon: return(new Pentagon());

            default:
                throw new NotSupportedException($"Unknown type {shape}");
            }
        }
Ejemplo n.º 23
0
        public  static void AddShape(Rect rect, ShapeTypes type)
        {
            Connectable shape = null;
           if (creators.ContainsKey(type))
           {
               Type creatingType = creators[type];
               IShapeCreator creator = Activator.CreateInstance(creatingType) as IShapeCreator;

               shape = creator.Create(rect) as Connectable;

               AddShape(shape, type); 
           }
            
        }
Ejemplo n.º 24
0
        public static IShape GetShape(ShapeTypes shapeTypes)
        {
            switch (shapeTypes)
            {
            case ShapeTypes.Circle:
                return(new Circle());

            case ShapeTypes.Rectangle:
                return(new Rectangle());

            default:
                return(null);
            }
        }
Ejemplo n.º 25
0
        public static void AddShape(Rect rect, ShapeTypes type)
        {
            Connectable shape = null;

            if (creators.ContainsKey(type))
            {
                Type          creatingType = creators[type];
                IShapeCreator creator      = Activator.CreateInstance(creatingType) as IShapeCreator;

                shape = creator.Create(rect) as Connectable;

                AddShape(shape, type);
            }
        }
Ejemplo n.º 26
0
        public override IShape GetShape(ShapeTypes shapeType)
        {
            switch (shapeType)
            {
            case ShapeTypes.Rectangle:
                return(new Rectangle());

            case ShapeTypes.Square:
                return(new Square());

            default:
                return(null);
            }
        }
Ejemplo n.º 27
0
 public ShapeModuleUI(ParticleSystemUI owner, SerializedObject o, string displayName) : base(owner, o, "ShapeModule", displayName, ModuleUI.VisibilityState.VisibleAndFolded)
 {
     this.m_BoxEditor = new BoxEditor(true, s_BoxHash);
     this.m_GuiNames  = new string[] { "Sphere", "HemiSphere", "Cone", "Box", "Mesh", "Circle", "Edge" };
     ShapeTypes[] typesArray1 = new ShapeTypes[7];
     typesArray1[1]            = ShapeTypes.HemiSphere;
     typesArray1[2]            = ShapeTypes.Cone;
     typesArray1[3]            = ShapeTypes.Box;
     typesArray1[4]            = ShapeTypes.Mesh;
     typesArray1[5]            = ShapeTypes.Circle;
     typesArray1[6]            = ShapeTypes.SingleSidedEdge;
     this.m_GuiTypes           = typesArray1;
     this.m_TypeToGuiTypeIndex = new int[] { 0, 0, 1, 1, 2, 3, 4, 2, 2, 2, 5, 5, 6 };
     base.m_ToolTip            = "Shape of the emitter volume, which controls where particles are emitted and their initial direction.";
 }
Ejemplo n.º 28
0
 public ShapeModuleUI(ParticleSystemUI owner, SerializedObject o, string displayName) : base(owner, o, "ShapeModule", displayName, ModuleUI.VisibilityState.VisibleAndFolded)
 {
     this.m_BoxEditor = new BoxEditor(true, s_BoxHash);
     this.m_GuiNames = new string[] { "Sphere", "HemiSphere", "Cone", "Box", "Mesh", "Circle", "Edge" };
     ShapeTypes[] typesArray1 = new ShapeTypes[7];
     typesArray1[1] = ShapeTypes.HemiSphere;
     typesArray1[2] = ShapeTypes.Cone;
     typesArray1[3] = ShapeTypes.Box;
     typesArray1[4] = ShapeTypes.Mesh;
     typesArray1[5] = ShapeTypes.Circle;
     typesArray1[6] = ShapeTypes.SingleSidedEdge;
     this.m_GuiTypes = typesArray1;
     this.m_TypeToGuiTypeIndex = new int[] { 0, 0, 1, 1, 2, 3, 4, 2, 2, 2, 5, 5, 6 };
     base.m_ToolTip = "Shape of the emitter volume, which controls where particles are emitted and their initial direction.";
 }
Ejemplo n.º 29
0
        // Order Shape Input
        public static Shape OrderShapeInput(ShapeTypes shapeType)
        {
            var shapeVariants = ShapeVariants();

            Console.WriteLine();
            foreach (var variant in shapeVariants)
            {
                Console.Write($"Please input the number of {variant.ShapeColor.ToString()} {shapeType.ToString()}: ");
                int.TryParse(UserInput(allowEmptyInput: true), out var qty);
                variant.Qty = qty;
            }

            var shape = ShapeFactory.GetShape((int)shapeType, shapeVariants);

            return(shape);
        }
Ejemplo n.º 30
0
        private bool ReadyForConnectorMove(out Cell nonArrowSideCell, out Shape fromShape)
        {
            nonArrowSideCell = null;
            fromShape        = null;

            if (visioControl.Document.Application.ActiveWindow.Selection.Count != 1)
            {
                Common.ErrorMessage("A single connector must be selected");
                return(false);
            }
            Shape      connector = visioControl.Document.Application.ActiveWindow.Selection[1];
            ShapeTypes type      = Common.GetShapeType(connector);

            if (type != ShapeTypes.Connector)
            {
                Common.ErrorMessage("A single connector must be selected");
                return(false);
            }

            Shadow connectorShadow = PathMaker.LookupShadowByShape(connector);

            if (connectorShadow == null)
            {
                Common.ErrorMessage("Connector is not a valid PathMaker shape");
                return(false);
            }

            nonArrowSideCell = connector.get_Cells("BeginX");
            Connect nonArrowSideConnect = null;

            foreach (Connect c in connector.Connects)
            {
                if (c.FromCell.Name.Equals(Strings.BeginConnectionPointCellName))
                {
                    nonArrowSideConnect = c;
                }
            }

            if (nonArrowSideConnect == null)
            {
                Common.ErrorMessage("Connector must be connected on the non-arrow side");
                return(false);
            }

            fromShape = nonArrowSideConnect.ToSheet;
            return(true);
        }
Ejemplo n.º 31
0
        internal Shape CreateShape(ShapeTypes type, int[] dimensions)
        {
            switch (type)
            {
            case ShapeTypes.circle:
                return(new Circle(dimensions));

            case ShapeTypes.square:
                return(new Square(dimensions));

            //case ShapeTypes.triangle:
            //    break;
            //case ShapeTypes.rectangle:
            //    break;
            default:
                return(null);
            }
        }
Ejemplo n.º 32
0
 private int ConvertConeTypeToConeEmitFrom(ShapeTypes shapeType)
 {
     if (shapeType != ShapeTypes.Cone)
     {
         if (shapeType == ShapeTypes.ConeShell)
         {
             return(1);
         }
         if (shapeType == ShapeTypes.ConeVolume)
         {
             return(2);
         }
         if (shapeType == ShapeTypes.ConeVolumeShell)
         {
             return(3);
         }
     }
     return(0);
 }
Ejemplo n.º 33
0
 public static Shapes GetShapes(ShapeTypes shapeTypes, dot[] Dots)
 {
     if (shapeTypes == ShapeTypes.Rectangle)
     {
         return(new Rectangle(Dots));
     }
     if (shapeTypes == ShapeTypes.Square)
     {
         return(new Square(Dots));
     }
     if (shapeTypes == ShapeTypes.Triangle)
     {
         return(new Triangle(Dots));
     }
     else
     {
         return(null);
     }
 }
Ejemplo n.º 34
0
 private int ConvertConeTypeToConeEmitFrom(ShapeTypes shapeType)
 {
     if (shapeType != ShapeTypes.Cone)
     {
         if (shapeType == ShapeTypes.ConeShell)
         {
             return 1;
         }
         if (shapeType == ShapeTypes.ConeVolume)
         {
             return 2;
         }
         if (shapeType == ShapeTypes.ConeVolumeShell)
         {
             return 3;
         }
     }
     return 0;
 }
        /// <summary>
        /// Constructor
        /// </summary>
        public SymbolControl()
        {
            InitializeComponent();

            this.AllowDrop = true;
            this.SetStyle(
                ControlStyles.UserPaint |
                ControlStyles.AllPaintingInWmPaint |
                ControlStyles.OptimizedDoubleBuffer, true);

            _shapeType    = ShapeTypes.Point;
            _markerType   = MarkerType.Simple;
            _cellSize     = new Size(25, 25);
            _symbolNumber = 256;
            _colNumber    = 10;
            _rowNumber    = 26;
            _selectedCell = -1;
            _imageList    = new List <Image>();
        }
Ejemplo n.º 36
0
        public static IShape GetShape(ShapeTypes shapeType)
        {
            switch(shapeType)
            {
                case ShapeTypes.CObject:
                    return new CObject();
                case ShapeTypes.ADTObject:
                    return new ADTObject();
                case ShapeTypes.SMObject:
                    return new SMObject();
                case ShapeTypes.SimpleRectangle:
                    return new SimpleRectangle();
                case ShapeTypes.SimpleEllipse:
                    return new SimpleEllipse();
                case ShapeTypes.TextLabel:
                    return new TextLabel();
                case ShapeTypes.ClassShape:
                    return new ClassShape();
                case ShapeTypes.TextOnly:
                    return new TextOnly();
                case ShapeTypes.ImageShape:
                    return new ImageShape();
                case ShapeTypes.DecisionShape:
                    break;
                case ShapeTypes.DataStoreObject:
                    return new DataStoreObject();
                    break;
                case ShapeTypes.DataSinkObject:
                    return new DataSinkObject();
                    break;
                case ShapeTypes.Terminator:
                    return new Terminator();
                    break;
                case ShapeTypes.CustomizedObject:
                    return new CustomizedObject();
                    break;
                default:
                    return null;
            }

            return null;
        }
Ejemplo n.º 37
0
        public Shape GetShape(ShapeTypes shapeType)
        {
            switch (shapeType)
            {
            case ShapeTypes.None:
                return(null);

            case ShapeTypes.Rectangle:
                return(new Rectangle());

            case ShapeTypes.Circle:
                return(new Circle());

            case ShapeTypes.Square:
                return(new Square());

            default:
                return(null);
            }
        }
Ejemplo n.º 38
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="aLayer"></param>
 /// <param name="aLayersTV"></param>
 public VectorLayerSet(VectorLayer aLayer, LayersLegend aLayersTV)
 {
     m_LayerName                  = aLayer.LayerName;
     m_FileName                   = aLayer.FileName;
     m_Handle                     = aLayer.Handle;
     m_Extent                     = aLayer.Extent;
     m_Visible                    = aLayer.Visible;
     m_LayerDrawType              = aLayer.LayerDrawType;
     m_LayerType                  = aLayer.LayerType;
     m_ShapeType                  = aLayer.ShapeType;
     m_AviodCollision             = aLayer.AvoidCollision;
     m_TransparencyPerc           = aLayer.TransparencyPerc;
     m_ShapeNum                   = aLayer.ShapeNum;
     m_LayersTV                   = aLayersTV;
     m_LegendSchemeE              = new LegendSchemeE();
     m_LegendSchemeE.LayerHandle  = aLayer.Handle;
     m_LegendSchemeE.LegendScheme = (LegendScheme)aLayer.LegendScheme.Clone();
     m_LegendSchemeE.LayersTV     = aLayersTV;
     m_IsMaskout                  = aLayer.IsMaskout;
 }
Ejemplo n.º 39
0
 /// <summary>
 /// Gets the shape.
 /// </summary>
 /// <param name="shapeType">Type of the shape.</param>
 /// <returns></returns>
 public static IShape GetShape(ShapeTypes shapeType) {
   switch (shapeType) {
     case ShapeTypes.SimpleRectangle:
       return new SimpleRectangle();
     case ShapeTypes.SimpleEllipse:
       return new SimpleEllipse();
     case ShapeTypes.TextLabel:
       return new TextLabel();
     case ShapeTypes.ClassShape:
       return new ClassShape();
     case ShapeTypes.TextOnly:
       return new TextOnly();
     case ShapeTypes.ImageShape:
       return new ImageShape();
     case ShapeTypes.ComplexRectangle:
       return new ComplexRectangle();
     default:
       return null;
   }
 }
Ejemplo n.º 40
0
        /// <summary>
        /// Import legend scheme from an image color palette file
        /// </summary>
        /// <param name="aFile">file path</param>
        public void ImportFromPaletteFile_Unique(string aFile)
        {
            StreamReader sr = new StreamReader(aFile);

            this.ShapeType    = ShapeTypes.Image;
            this.LegendType   = LegendType.UniqueValue;
            this.LegendBreaks = new List <ColorBreak>();
            ColorBreak aCB = new ColorBreak();

            string[] dataArray;
            int      lastNonEmpty, i;

            sr.ReadLine();
            string aLine = sr.ReadLine();

            while (aLine != null)
            {
                dataArray    = aLine.Split();
                lastNonEmpty = -1;
                List <int> dataList = new List <int>();
                for (i = 0; i < dataArray.Length; i++)
                {
                    if (dataArray[i] != string.Empty)
                    {
                        lastNonEmpty++;
                        dataList.Add(int.Parse(dataArray[i]));
                    }
                }
                Color aColor = Color.FromArgb(255, dataList[3], dataList[2], dataList[1]);
                aCB            = new ColorBreak();
                aCB.Color      = aColor;
                aCB.StartValue = dataList[0];
                aCB.EndValue   = dataList[0];
                aCB.Caption    = aCB.StartValue.ToString();
                this.LegendBreaks.Add(aCB);

                aLine = sr.ReadLine();
            }
            sr.Close();
        }
Ejemplo n.º 41
0
 public static List<Shadow> LookupShadowsByShapeType(ShapeTypes shapeType)
 {
     List<Shadow> list = new List<Shadow>();
     foreach (Shadow shadow in shadowShapeMap.Values)
         if (shadow.GetShapeType() == shapeType)
             list.Add(shadow);
     return list;
 }
Ejemplo n.º 42
0
        /// <summary>
        /// Parses the first 100 bytes of a shapefile into the important values
        /// </summary>
        /// <param name="inFilename">The filename to read</param>
        public void Open(string inFilename)
        {
            _filename = inFilename;

            //  Position        Field           Value       Type        ByteOrder
            //  --------------------------------------------------------------
            //  Byte 0          File Code       9994        Integer     Big
            //  Byte 4          Unused          0           Integer     Big
            //  Byte 8          Unused          0           Integer     Big
            //  Byte 12         Unused          0           Integer     Big
            //  Byte 16         Unused          0           Integer     Big
            //  Byte 20         Unused          0           Integer     Big
            //  Byte 24         File Length     File Length Integer     Big
            //  Byte 28         Version         1000        Integer     Little
            //  Byte 32         Shape Type      Shape Type  Integer     Little
            //  Byte 36         Bounding Box    Xmin        Double      Little
            //  Byte 44         Bounding Box    Ymin        Double      Little
            //  Byte 52         Bounding Box    Xmax        Double      Little
            //  Byte 60         Bounding Box    Ymax        Double      Little
            //  Byte 68         Bounding Box    Zmin        Double      Little
            //  Byte 76         Bounding Box    Zmax        Double      Little
            //  Byte 84         Bounding Box    Mmin        Double      Little
            //  Byte 92         Bounding Box    Mmax        Double      Little

            BufferedBinaryReader bbReader = new BufferedBinaryReader(inFilename);

            bbReader.FillBuffer(100); // we only need to read 100 bytes from the header.

            bbReader.Close(); // Close the internal readers connected to the file, but don't close the file itself.

            

            // Reading BigEndian simply requires us to reverse the byte order.
            _fileCode = bbReader.ReadInt32(false);

            // Skip the next 20 bytes because they are unused
            bbReader.Seek(20, System.IO.SeekOrigin.Current);

            // Read the file length in reverse sequence
            _fileLength = bbReader.ReadInt32(false);

            // From this point on, all the header values are in little endian

            // Read the version 
            _version = bbReader.ReadInt32();

            // Read in the shapetype that should be the shapetype for the whole shapefile
            _shapeType = (ShapeTypes)bbReader.ReadInt32();

            // Get the extents, each of which are double values.
            _xMin = bbReader.ReadDouble();
            _yMin = bbReader.ReadDouble();
            _xMax = bbReader.ReadDouble();
            _yMax = bbReader.ReadDouble();
            _zMin = bbReader.ReadDouble();
            _zMax = bbReader.ReadDouble();
            _mMin = bbReader.ReadDouble();
            _mMax = bbReader.ReadDouble();

            bbReader.Dispose();
        }
Ejemplo n.º 43
0
		/// <summary>
		/// Activates the corresponding tool to the given shapeType value if the tool is not already active, and then returns the previous tool
		/// if a tool switch has occurred or null otherwise. If a switch did occur and this was called in e.g. an event handler, it should most
		/// likely pass the event data on to the newly activated tool (accessing it using PintaCore.Tools.CurrentTool) and then return.
		/// </summary>
		/// <param name="shapeType">The index of the shape in SEngines to find the corresponding tool to and switch to.</param>
		/// <param name="permanentSwitch">Whether the tool switch is permanent or just temporary (for drawing).</param>
		/// <returns>The *previous* tool if a tool switch has occurred or null otherwise.</returns>
		public static ShapeTool ActivateCorrespondingTool(ShapeTypes shapeType, bool permanentSwitch)
		{
			ShapeTool correspondingTool = GetCorrespondingTool(shapeType);

			//Verify that the corresponding tool is valid and that it doesn't match the currently active tool.
			if (correspondingTool != null && PintaCore.Tools.CurrentTool != correspondingTool)
			{
				ShapeTool oldTool = PintaCore.Tools.CurrentTool as ShapeTool;

				//The active tool needs to be switched to the corresponding tool.
				PintaCore.Tools.SetCurrentTool(correspondingTool);

				ShapeTool newTool = (ShapeTool)PintaCore.Tools.CurrentTool;

				//What happens next depends on whether the old tool was an editable ShapeTool.
				if (oldTool != null && oldTool.IsEditableShapeTool)
				{
					if (permanentSwitch)
					{
						//Set the new tool's active shape and point to the old shape and point.
						newTool.EditEngine.SelectedPointIndex = oldTool.EditEngine.SelectedPointIndex;
						newTool.EditEngine.SelectedShapeIndex = oldTool.EditEngine.SelectedShapeIndex;

						//Make sure neither tool thinks it is drawing anything.
						newTool.EditEngine.is_drawing = false;
						oldTool.EditEngine.is_drawing = false;
					}

					ShapeEngine activeEngine = newTool.EditEngine.ActiveShapeEngine;

					if (activeEngine != null)
					{
						newTool.EditEngine.UpdateToolbarSettings(activeEngine);
					}
				}
				else
				{
					if (permanentSwitch)
					{
						//Make sure that the new tool doesn't think it is drawing anything.
						newTool.EditEngine.is_drawing = false;
					}
				}

				//Let the caller know that the active tool has been switched.
				return oldTool;
			}

			//Let the caller know that the active tool has not been switched.
			return null;
		}
Ejemplo n.º 44
0
		/// <summary>
		/// Gets the corresponding tool to the given shape type and then returns that tool.
		/// </summary>
		/// <param name="ShapeType">The shape type to find the corresponding tool to.</param>
		/// <returns>The corresponding tool to the given shape type.</returns>
		public static ShapeTool GetCorrespondingTool(ShapeTypes shapeType)
		{
			ShapeTool correspondingTool = null;
			
			//Get the corresponding BaseTool reference to the shape type.
			CorrespondingTools.TryGetValue(shapeType, out correspondingTool);

			return correspondingTool;
		}
Ejemplo n.º 45
0
 public cShapeOutline GetAdjustedShape(List<Point> lpShapePoints, Color cShapeColor, ShapeTypes stShapeType)
 {
     for (int i = 0; i < lpShapePoints.Count; i++)
         lpShapePoints[i] = GetAdjustedPoint(lpShapePoints[i]);
     return new cShapeOutline(stShapeType, lpShapePoints, cShapeColor);
 }
Ejemplo n.º 46
0
 private int ConvertConeTypeToConeEmitFrom(ShapeTypes shapeType)
 {
     return Array.IndexOf<ShapeTypes>(this.coneShapes, shapeType);
 }
Ejemplo n.º 47
0
 private bool GetUsesShell(ShapeTypes shapeType)
 {
     return (Array.IndexOf<ShapeTypes>(this.shellShapes, shapeType) != -1);
 }
Ejemplo n.º 48
0
 public Shadow(Shape shape)
 {
     this.shape = shape;
     this.shapeType = Common.GetShapeType(shape);
 }
 public static string Dump(ShapeTypes value)
 {
     var assistant = new AssistantDumper();
     Dump(assistant, value);
     return assistant.ToString();
 }
Ejemplo n.º 50
0
        /// <summary>
        /// This creates a polygon shape from an extent. 
        /// </summary>
        /// <param name="ext">The extent to turn into a polygon shape.</param>
        public ShapeRange(Extent ext)
        {
            Extent = ext;
            Parts = new List<PartRange>();
            _numParts = -1;
            // Counter clockwise
            // 1 2
            // 4 3
            double[] coords = new double[8];
            // C1
            coords[0] = ext.XMin;
            coords[1] = ext.YMax;
            // C2
            coords[2] = ext.XMax;
            coords[3] = ext.YMax;
            // C3
            coords[4] = ext.XMax;
            coords[5] = ext.YMin;
            // C4
            coords[6] = ext.XMin;
            coords[7] = ext.YMin;

            FeatureType = FeatureTypes.Polygon;
            ShapeType = ShapeTypes.Polygon;
            PartRange pr = new PartRange(coords, 0,0, FeatureTypes.Polygon);
            pr.NumVertices = 4;
            Parts.Add(pr);
            
        }
Ejemplo n.º 51
0
		/// <summary>
		/// Adds a predefined shape
		/// </summary>
		/// <param name="type"></param>
		/// <param name="location"></param>
		public ShapeBase AddShape(ShapeTypes type, Point location)
		{
			ShapeBase shape = null;
			switch(type)
			{
				case ShapeTypes.Rectangular:
					shape = new SimpleRectangle(this);
					break;
				case ShapeTypes.Oval:
					shape = new OvalShape(this);
					break;
				case ShapeTypes.TextLabel:
					shape = new TextLabel(this);
					shape.Location = location;
					shape.ShapeColor = Color.Transparent;
					shape.Text = "A text label (change the text in the property grid)";
					shape.Width = 350;
					shape.Height = 30;
					Shapes.Add(shape);
					return shape;


			}
			if(shape==null) return null;
			shape.ShapeColor = Color.FromArgb(rnd.Next(0,255),rnd.Next(0,255),rnd.Next(0,255));
			shape.Location = location;
			Shapes.Add(shape);
			return shape;
		}
Ejemplo n.º 52
0
 public AddShapeCommand(UIElement shape, ShapeTypes type, Canvas canvas)
 {
     mShapeType = type;
     mShape = shape;
     mCanvas = canvas;
 }