コード例 #1
0
        protected static ElementTypeEnum ResolveKind(IBase item)
        {
            ElementTypeEnum kind = ElementTypeEnum.Undefined;

            if (item is ReferentialEntity)
            {
                kind = ElementTypeEnum.Entity;
            }

            else if (item is ReferentialRelationship)
            {
                kind = ElementTypeEnum.Entity;
            }

            else if (item is ReferentialRelationshipLink)
            {
                kind = ElementTypeEnum.Link;
            }

            else if (item is EntityDefinition)
            {
                kind = ElementTypeEnum.EntityDefinition;
            }

            else if (item is RelationshipDefinition)
            {
                kind = ElementTypeEnum.RelationshipDefinition;
            }

            else if (item is LinkDefinition)
            {
                kind = ElementTypeEnum.RelationshipLinkDefinition;
            }
            return(kind);
        }
コード例 #2
0
 public VisualShapeAtom(BinaryReader _reader, uint size, uint typeCode, uint version, uint instance)
     : base(_reader, size, typeCode, version, instance)
 {
     type       = (TimeVisualElementEnum)this.Reader.ReadInt32();
     refType    = (ElementTypeEnum)this.Reader.ReadInt32();
     shapeIdRef = this.Reader.ReadUInt32();
     data1      = this.Reader.ReadInt32();
     data2      = this.Reader.ReadInt32();
 }
コード例 #3
0
ファイル: TableInfo.cs プロジェクト: coyove/Luavit
 public TableInfo(BuiltInCategory builtInCategory, ElementTypeEnum instanceOrSymbol, APIObjectList list) : this(string.Concat(new object[]
 {
     "TabN_",
     builtInCategory,
     "_",
     instanceOrSymbol
 }))
 {
     this.m_objectList = list;
     list.TableInfo    = this;
 }
コード例 #4
0
        /// <summary>
        /// 增加预警区域
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnAddArea_Click(object sender, EventArgs e)
        {
            var tool = mapLogic.GetToolBox();

            if (tool == null)
            {
                return;
            }

            ElementTypeEnum type = cmbAreaType.Text == "多边形" ? ElementTypeEnum.Polygon : ElementTypeEnum.Rectangle;

            tool.CommondExecutedEvent += Tool_CommondExecutedEvent;
            tool.DrawGraphic(type);
            this.Visible = false;
        }
コード例 #5
0
ファイル: Coords.cs プロジェクト: dobrybajer/Golf
        public static Coords GetCoordFromString(string line, ElementTypeEnum type)
        {
            var coords = line.Split(',');
            int x, y;

            if (!int.TryParse(coords[0], out x))
            {
                throw new ArgumentException("X coordinate is not correct number. It must be a non-negative number less than 2^32.");
            }

            if (!int.TryParse(coords[1], out y))
            {
                throw new ArgumentException("Y coordinate is not correct number. It must be a non-negative number less than 2^32.");
            }

            return(new Coords(x, -y, type));
        }
コード例 #6
0
ファイル: ToolBox.cs プロジェクト: AnuoF/MapFrame
        /// <summary>
        /// 画图形
        /// </summary>
        /// <param name="type">图形类型</param>
        public void DrawGraphic(ElementTypeEnum type)
        {
            ReleaseTool();

            switch (type)
            {
            case Core.Model.ElementTypeEnum.Model3D:
                break;

            case Core.Model.ElementTypeEnum.Point:
                currentTool = new DrawPoint(mapControl);
                break;

            case Core.Model.ElementTypeEnum.Line:
                currentTool = new DrawLine(mapControl);
                break;

            case Core.Model.ElementTypeEnum.Polygon:
                currentTool = new DrawPolygon(mapControl);
                break;

            case Core.Model.ElementTypeEnum.Circle:
                currentTool = new DrawCircle(mapControl);
                break;

            case Core.Model.ElementTypeEnum.Picture:
                break;

            case Core.Model.ElementTypeEnum.Rectangle:
                currentTool = new DrawRectangle(mapControl);
                break;

            case Core.Model.ElementTypeEnum.Text:
                currentTool = new DrawText(mapControl);
                break;

            case Core.Model.ElementTypeEnum.Other:
                break;
            }
            if (currentTool != null)
            {
                (currentTool as IMFDraw).MapLogic = mapLogic;
                currentTool.CommondExecutedEvent += currentTool_CommondExecutedEvent;
                currentTool.RunCommond();
            }
        }
コード例 #7
0
        public DataTable GetFullElementWithSetting(ElementTypeEnum elementType, int userId)
        {
            var db         = new TableBasedSp(RunSpName);
            var parameters = new Dictionary <string, string>
            {
                { "ProgramId", ProgramId.ToString() },
                { "ElementTypeId", ((int)elementType).ToStringVar() },
                { "UserId", userId.ToString() }
            };

            try
            {
                return(db.GetFirstTableOfData("uspVisibleElementDataForUser", ConnectionString, parameters));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #8
0
        public List <ElementAccessModel> GetElementAccess(ElementTypeEnum elementType, int userId)
        {
            var db         = new TableBasedSp(RunSpName);
            var parameters = new Dictionary <string, string>
            {
                { "ProgramId", ProgramId.ToString() },
                { "ElementTypeId", ((int)elementType).ToStringVar() },
                { "UserId", userId.ToString() }
            };

            try
            {
                var dt       = db.GetFirstTableOfData("uspVisibleElementDataForUser", ConnectionString, parameters);
                var elements = new DataTableToList().Convert <ElementAccessModel>(dt);
                return(elements);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #9
0
        /// <summary>
        /// 构造函数,没传图片的情况,用GDI绘制点
        /// </summary>
        /// <param name="pos">位置</param>
        /// <param name="point">点的kml对象</param>
        /// <param name="elementName">图元名称</param>
        public Point_GMap(PointLatLng pos, KmlPoint point, string elementName)
            : base(pos)
        {
            this.ElementName = elementName;
            this.Description = point.Description;
            this.ElementType = ElementTypeEnum.Point;
            // 鼠标经过可见
            base.IsHitTestVisible = true;
            // 大小
            if (point.Size == null)
            {
                base.Size = new Size(5, 5);
            }
            else
            {
                int width  = point.Size.Width;
                int height = point.Size.Height;
                base.Size = new System.Drawing.Size(width, height);
            }

            // 画笔
            m_HightLightPen = new Pen(Brushes.Green, 1);
            if (point.Color.ToArgb() == 0)
            {
                m_Pen = new Pen(Brushes.Blue, 2);
            }
            else
            {
                m_Pen = new Pen(point.Color, 2);
            }

            // 计时器
            flashTimer          = new System.Timers.Timer();
            flashTimer.Elapsed += flashTimer_Elapsed;
            flashTimer.Interval = 100;
            bIsFlash            = false;

            base.Tag = this;
        }
コード例 #10
0
            /// <summary>Создание нового элемента с указанной информацией в атрибутах в указанном узле документа XML.</summary>
            /// <param name="x_xnElementParent">узел документа XML, в который добавляется новый элемент.</param>
            /// <param name="x_sElementName">имя нового элемента.</param>
            /// <param name="x_lElementType">тип нового элемента.</param>
            /// <param name="x_sElementData">данные нового элемента.</param>
            public static void AddElement(
                XmlNode x_xnElementParent,
                string x_sElementName,
                ElementTypeEnum x_lElementType,
                params string[] x_sElementData)
            {
                // Создание нового элемента.
                XmlNode c_xnElement = x_xnElementParent.OwnerDocument.CreateNode("element", x_sElementName, "");

                switch (x_lElementType)
                {
                case ElementTypeEnum.ATTRIBUTE_ELEMENT:
                    for (int i = 0; i < x_sElementData.Length; i += 2)
                    {
                        // Добавление атрибута к новому элементу и присваивание ему значения.
                        c_xnElement.Attributes.Append(x_xnElementParent.OwnerDocument.CreateAttribute(x_sElementData[i]));
                        c_xnElement.Attributes[x_sElementData[i]].InnerText = x_sElementData[i + 1];
                    }
                    break;

                case ElementTypeEnum.NODE_ELEMENT:
                    for (int i = 0; i < x_sElementData.Length; i += 2)
                    {
                        // Добавление дочернего узла к новому элементу и присваивание ему значения.
                        c_xnElement.AppendChild(x_xnElementParent.OwnerDocument.CreateNode(XmlNodeType.Element, x_sElementData[i], ""));
                        c_xnElement.LastChild.InnerText = x_sElementData[i + 1];
                    }
                    break;

                default:
                    throw new Exception(
                              String.Format(
                                  CResource.LoadString("IDS_ERR_INVALIDELEMENTTYPE"),
                                  Enum.Format(typeof(ElementTypeEnum), x_lElementType, "G")));
                }
                // Добавление созданного элемента к родительскому элементу документа XML.
                x_xnElementParent.AppendChild(c_xnElement);
            }
コード例 #11
0
ファイル: ToolBox.cs プロジェクト: AnuoF/MapFrame
        /// <summary>
        /// 绘制图元
        /// </summary>
        /// <param name="type">图元类型</param>
        public void DrawGraphic(ElementTypeEnum type)
        {
            ReleaseTool();//释放之前的工具

            switch (type)
            {
            case ElementTypeEnum.Line:    //画线
                currentTool = new DrawLine(gmapControl);
                break;

            case ElementTypeEnum.Polygon:    //画多边形
                currentTool = new DrawPolygon(gmapControl);
                break;

            case ElementTypeEnum.Rectangle:    //画矩形
                currentTool = new DrawRectangle(gmapControl);
                break;

            case ElementTypeEnum.Circle:    //画圆
                currentTool = new DrawCircle(gmapControl);
                break;

            case ElementTypeEnum.Text:    //文字
                currentTool = new DrawText(gmapControl);
                break;

            case ElementTypeEnum.Other:    //其他
                break;
            }

            if (currentTool != null)
            {
                (currentTool as IMFDraw).MapLogic = mapLogic;
                currentTool.CommondExecutedEvent += CommondExecutedEvent;
                currentTool.RunCommond();//执行命令
            }
        }
コード例 #12
0
ファイル: APIObjectList.cs プロジェクト: coyove/Luavit
 public static string GenerateResourceIdsForTableName(ElementTypeEnum symbolOrInstance, BuiltInCategory categoryId)
 {
     return(string.Format("TabN_{0}_{1}", categoryId, symbolOrInstance));
 }
コード例 #13
0
ファイル: Spell.cs プロジェクト: sakseichek/homm
        public void CopyFrom(Spell spell)
        {
            this._id = spell._id;
            this._name = spell._name;
            this._elementType = spell._elementType;
            this._spellType = spell._spellType;
            this._level = spell._level;

            this._basicCost = spell._basicCost;
            this._cost = spell._cost;

            this._duration = spell._duration;
            this._basicDamage = spell._basicDamage;
            this._damageLevels[0] = spell._damageLevels[0];
            this._damageLevels[1] = spell._damageLevels[1];
            this._damageLevels[2] = spell._damageLevels[2];
            this._damage = spell._damage;
            this._isAll = spell._isAll;
            this._isSummon = spell._isSummon;
            this._description = spell._description;
            this._isMissile = spell._isMissile;
            this._isHit = spell._isHit;
            this._targetType = spell._targetType;
            this._isDamage = spell._isDamage;
            this._bookImgFileName = spell._bookImgFileName;
        }
コード例 #14
0
ファイル: Spell.cs プロジェクト: sakseichek/homm
        public Spell()
        {
            _id = 0;
            _basicCost = 0;

            _basicCost = 0;
            _cost = 0;

            _damage = 0;
            _damageLevels = new int[3];
            _elementType = ElementTypeEnum.None;
            _isMissile = false;
            _isHit = false;
            _isDamage = false;
            _bookImgFileName = "";
        }
コード例 #15
0
ファイル: Coords.cs プロジェクト: dobrybajer/Golf
 public Coords(int x, int y, ElementTypeEnum type)
 {
     X    = x;
     Y    = y;
     Type = type;
 }
コード例 #16
0
 public ObjectID(string id, ElementTypeEnum type)
 {
     ID   = id;
     Type = type;
 }
コード例 #17
0
ファイル: SymbolList.cs プロジェクト: coyove/Luavit
 public SymbolList(BuiltInCategory builtInCategory)
 {
     this.m_category         = builtInCategory;
     this.m_instanceOrSymbol = ElementTypeEnum.SYMBOL;
 }
コード例 #18
0
ファイル: APIObjectList.cs プロジェクト: coyove/Luavit
        public static System.Collections.Generic.List <string> GenerateResourceIdsForTableName(Element element, BuiltInCategory categoryId)
        {
            System.Collections.Generic.List <string> list = new System.Collections.Generic.List <string>();
            ElementTypeEnum elementTypeEnum = (element is ElementType) ? ElementTypeEnum.SYMBOL : ElementTypeEnum.INSTANCE;

            list.Add(string.Format("TabN_{0}_{1}", categoryId, elementTypeEnum));
            BuiltInCategory builtInCategory = (BuiltInCategory)(-1);
            bool            flag            = false;
            FamilyInstance  familyInstance  = element as FamilyInstance;

            if (familyInstance != null && familyInstance.Host != null)
            {
                builtInCategory = APIObjectList.GetCategoryId(familyInstance.Host);
                flag            = true;
            }
            else
            {
                LoadBase loadBase = element as LoadBase;
                if (loadBase != null && loadBase.HostElement != null)
                {
                    builtInCategory = APIObjectList.GetCategoryId(loadBase.HostElement);
                    flag            = true;
                }
                else
                {
                    Opening opening = element as Opening;
                    if (opening != null && opening.Host != null)
                    {
                        builtInCategory = APIObjectList.GetCategoryId(opening.Host);
                        list.Add(string.Format("TabN_{0}_{1}", "OST_Type_Opening", builtInCategory));
                        list.Add("TabN_Type_" + opening.GetType().FullName.Replace('.', '_'));
                    }
                    else
                    {
                        Rebar rebar = element as Rebar;
                        if (rebar != null && rebar.GetHostId() != ElementId.InvalidElementId)
                        {
                            builtInCategory = APIObjectList.GetCategoryId(rebar.GetHostId(), rebar.Document);
                            flag            = true;
                        }
                    }
                }
            }
            if (flag)
            {
                list.Add(string.Format("TabN_{0}_{1}", categoryId, builtInCategory));
            }
            if (element is RoomTag)
            {
                list.Add("TabN_Type_" + element.GetType().FullName.Replace('.', '_'));
            }
            if (element != null && element.Id.IntegerValue != -1)
            {
                if (element.LevelId != ElementId.InvalidElementId)
                {
                    list.Add("TabN_CST_ElementLevel");
                }
                if (element.CreatedPhaseId != ElementId.InvalidElementId)
                {
                    list.Add("TabN_CST_ElementPhase");
                }
            }
            return(list);
        }