public AnimationProcess(EntityNode entity, AnimationMode mode, int frameDelay, int[] frames) { _entity = entity; _mode = mode; _frameDelay = frameDelay; _frames = frames; }
public GameObjectNode VisitGameObject(DazelParser.GameObjectContext context) { GameObjectTypeNode typeNode; switch (context.gameObjectType.Type) { case DazelLexer.SCREEN: typeNode = new ScreenNode(); break; case DazelLexer.ENTITY: typeNode = new EntityNode(); break; case DazelLexer.MOVE_PATTERN: typeNode = new MovePatternNode(); break; default: throw new ArgumentException("Type is not a GameObjectType!"); } GameObjectNode gameObjectNode = new GameObjectNode() { Token = context.Start, Identifier = context.GetChild(1).GetText(), TypeNode = typeNode, Contents = VisitGameObjectContents(context.gameObjectBlock().gameObjectContents()) }; return(gameObjectNode); }
public EvaluateResult EvaluateRule(EntityNode node, IEnumerable <EntityNodeRuleContainer> rules, Guid permission) { var filteredRules = rules .Where(x => x.SecurityRule.Rule.Right == permission && ( x.SecurityRule.EntityId == node.EntityId || x.SecurityRule.Rule.Inherit )) .ToList(); var ruleToApply = filteredRules //order from most specific to the most generic .OrderByDescending(x => x.NodeIdPath.Length) //deny rule wins over allow rule .ThenBy(x => x.SecurityRule.Rule.Type == RuleType.Deny ? 0 : 1) .Select(x => x.SecurityRule) .FirstOrDefault(); if (ruleToApply == null) { ruleToApply = _securityOptions.DefaultSecurityRules .First(x => x.Rule.Right == permission); } var isGranted = ruleToApply.Rule.Type == RuleType.Allow; return(new EvaluateResult(node.EntityId, permission, isGranted, ruleToApply)); }
/// <summary> /// Initializes a new instance of this window. /// </summary> /// <param name="entity">The entity this window should be bound to.</param> public EntityPropertiesWindow(EntityNode entity) { _entity = entity; InitializeComponent(); SyncronizeData(); propertyListView.SetValueDelegate += new PropertyListViewSetValueDelegate(SetValue); }
public void EntityNode_adding_tag_twice_by_name_fails_gracefully() { // ARRANGE var e = DefaultEntity(WithAssignedDefaultTag); var tag = e.Tags.Single(); this.ProviderContextMock .Setup(c => c.Persistence) .Returns(this.PersistenceMock.Object); this.PersistenceMock .Setup(p => p.Tags) .Returns(this.TagRepositoryMock.Object); this.TagRepositoryMock .Setup(r => r.FindByName("t")) .Returns(tag); // ACT var result = new EntityNode(e).NewItem(this.ProviderContextMock.Object, "t", itemTypeName: null, newItemValue: null); // ASSERT Assert.IsType <AssignedTagNode>(result); }
public void EntityNode_adds_tag_by_name() { // ARRANGE var e = DefaultEntity(WithoutTags); this.ProviderContextMock .Setup(c => c.Persistence) .Returns(this.PersistenceMock.Object); this.PersistenceMock .Setup(p => p.Entities) .Returns(this.EntityRepositoryMock.Object); this.EntityRepositoryMock .Setup(r => r.Upsert(e)) .Returns(e); this.PersistenceMock .Setup(p => p.Tags) .Returns(this.TagRepositoryMock.Object); this.TagRepositoryMock .Setup(r => r.FindByName("t")) .Returns(DefaultTag()); // ACT var result = new EntityNode(e).NewItem(this.ProviderContextMock.Object, "t", itemTypeName: null, newItemValue: null); // ASSERT Assert.IsType <AssignedTagNode>(result); }
public EntityNode AddEntityNode(String nodeName, Entity entity) { EntityNode node = new EntityNode(entity); Nodes.Add(nodeName, node); return node; }
public NetworkView2() { force = D3.Layout.Force() .Size(new int[] { width, height }) .On("tick", Tick); // var force = d3.layout.force() //.size([width, height]) //.on("tick", tick); svg = D3.Select("body").Append("svg") .Attr("width", width) .Attr("height", height); //var svg = d3.select("body").append("svg") // .attr("width", width) // .attr("height", height); link = svg.SelectAll(".link"); node = svg.SelectAll(".node"); //var link = svg.selectAll(".link"), // node = svg.selectAll(".node"); //root = new ForceNode("Test", 100); //Update(); D3.Json("../js/json_data.js", delegate(object state, object json) { root = (EntityNode)json; Update(); }); }
public PolygonEntity(EntityNode node) { this.Representation = node.Representation; this.FeatureCode = node.FeatureCode; this.EntityID = node.EntityID; //CreateFeature(node); }
protected override DataRow CreateRow(EntityNode entityNode) { DataRow dataRow = base.CreateRow(entityNode); if (dataRow != null) { LineNode lineNode = entityNode as LineNode; if (lineNode != null) { dataRow[FieldName_LineNodeID] = m_nNewIndexID++; dataRow[FieldName_LineType] = lineNode.LineType; if (lineNode.SegmentNodes != null) { if (lineNode.SegmentNodes.Count > 0) { BrokenLineNode line = lineNode.SegmentNodes[0] as BrokenLineNode; if (line != null && line.PointInfoNodes.Count >= 2) { dataRow[FieldName_X1] = line.PointInfoNodes[0].X; dataRow[FieldName_Y1] = line.PointInfoNodes[0].Y; dataRow[FieldName_X2] = line.PointInfoNodes[1].X; dataRow[FieldName_Y2] = line.PointInfoNodes[1].Y; } } } return(dataRow); } } return(null); }
void addSprite(object param) { EntityNode source = param as EntityNode; OpenFileDialog dialog = new OpenFileDialog(); dialog.Filter = "Sprite Files (*.png, *.bmp)|*.png;*.bmp"; bool?dialogOpen = dialog.ShowDialog(); dialog.Multiselect = false; if (dialogOpen == true) { using (new WaitCursorHelper()) { Debug.WriteLine("Filepath:" + dialog.FileName); byte[] image = File.ReadAllBytes(dialog.FileName); MemoryStream imageMemoryStream = new MemoryStream(image); BitmapImage loadedImage = new BitmapImage(); loadedImage.CacheOption = BitmapCacheOption.OnLoad; loadedImage.BeginInit(); loadedImage.StreamSource = imageMemoryStream; loadedImage.EndInit(); //Entity EntitySprite entitySprite = new EntitySprite(source, Path.GetFileNameWithoutExtension(dialog.FileName), loadedImage); source.Childs.Add(entitySprite); } } }
private static void PopulateBuilder(IEnumerable <Node> nodes, ExpressionBuilder builder) { foreach (Node node in nodes) { if (node is TextNode) { TextNode node2 = (TextNode)node; builder.AppendLiteral(node2.Text); } else if (!(node is EntityNode)) { if (!(node is ExpressionNode)) { throw new CompilerException("Unknown content in attribute"); } ExpressionNode node4 = (ExpressionNode)node; builder.AppendExpression(node4.Code); } else { EntityNode node3 = (EntityNode)node; builder.AppendLiteral("&" + node3.Name + ";"); } } }
void openEntity(object param) { EntityNode source = param as EntityNode; Debug.WriteLine("Double Clicked on:" + source.Name); OpenItemMessage.Send(source); }
void addScreen(object param) { EntityNode source = param as EntityNode; EntityScreen newScreen = new EntityScreen("Foo", source); source.Childs.Add(newScreen); }
public static EntityNode GetAncestorNodeByName(long parentNodeId, string name) { EntityNode result = null; const string query = "Select DataID FROM [OTCS].[dbo].[DTreeCore] Where ABS([ParentID]) = @parentNodeId AND UPPER([Name]) LIKE @name"; using (var connection = new SqlConnection(GetConnectionString())) { var command = new SqlCommand(query, connection); command.Parameters.AddWithValue("@name", "%" + name + "%"); command.Parameters.AddWithValue("@parentNodeId", parentNodeId); try { connection.Open(); var reader = command.ExecuteReader(); while (reader.Read()) { var itemNodeId = Convert.ToInt64(reader["DataID"]); result = VariableHelper.Dmo.GetEntityNodeFromId(OtCredentialsEnum.ConvertString(OtCredentialsEnum.OtAdminCredentials.User), VariableHelper.Token, itemNodeId, false, false, false); } reader.Close(); connection.Close(); return(result); } catch (Exception ex) { Console.WriteLine(Resources.ErrorTypeDbTransacts + ex.ToString()); Logger.Error(ex, Resources.ErrorTypeDbTransacts); throw; } } }
/// <summary> /// 创建点实体 /// </summary> /// <param name="pITable">数据表对象</param> /// <param name="entinyNode">VCT空间实体节点</param> public override void CreateFeature(ITable pITable, EntityNode entinyNode) { try { PointNode pPointNode = entinyNode as PointNode; if (pPointNode != null) { IFeatureClass pFeatureCls = pITable as IFeatureClass; this.Feature = pFeatureCls.CreateFeature(); ///标识码赋值 int dBSMIndex = -1; dBSMIndex = this.Feature.Fields.FindField(m_strEntityIDFiled); if (dBSMIndex != -1) this.Feature.set_Value(dBSMIndex, pPointNode.EntityID); ///要素代码赋值 int dSYDMIndex = -1; dSYDMIndex = this.Feature.Fields.FindField(m_strYSDMField); if (dSYDMIndex != -1) this.Feature.set_Value(dSYDMIndex, pPointNode.FeatureCode); IPoint pPoint = new PointClass(); pPoint.PutCoords(pPointNode.PointInfoNode.X, pPointNode.PointInfoNode.Y); (this.Feature as IFeature).Shape = pPoint; this.Feature.Store(); } } catch (Exception ex) { LogAPI.WriteErrorLog(ex); } }
public ActionResult EntityTreeNodes(EntityNode node) { List <EntityNode> result; if (node.Id == null) { result = categories.Select(x => new EntityNode { Id = x.Id, Text = x.Name, HasChild = x.Products.Any(), ParentId = null, Type = "c" }).ToList(); } else { result = categories.Where(x => x.Id == node.Id).SelectMany(x => x.Products, (parent, child) => new EntityNode { Id = child.Id, Text = child.Name, HasChild = false, ParentId = null, Type = "p" }).ToList(); } return(Json(result)); }
public void EntityNode_renaming_rejects_duplicate_entity_name(string existingName) { // ARRANGE var parentCategory = DefaultCategory(WithSubCategory(DefaultCategory())); var entity = DefaultEntity(WithEntityCategory(parentCategory)); this.ProviderContextMock .Setup(c => c.Persistence) .Returns(this.PersistenceMock.Object); this.PersistenceMock .Setup(p => p.Entities) .Returns(this.EntityRepositoryMock.Object); var existingEntity = DefaultEntity(WithEntityCategory(parentCategory), e => e.Name = existingName); this.EntityRepositoryMock .Setup(p => p.FindByCategoryAndName(parentCategory, "ee")) .Returns(existingEntity); var entityNode = new EntityNode(entity); // ACT entityNode.RenameItem(this.ProviderContextMock.Object, "e", "ee"); // ASSERT Assert.Equal("e", entity.Name); }
private static int GetSize(EntityNode node) { Entity entity = ((Entity)node.SourceData); int size = 0; switch (entity.LogicalName) { case "account": size = 15; break; case "contact": size = 10; break; default: size = 20; break; } // Make bigger if the root node size = size + (node.Root ? 2 : 0); return(size); }
public void EntityNode_rejects_moving_itself_to_category_if_category_name_already_exists() { // ARRANGE this.ProviderContextMock .Setup(p => p.Persistence) .Returns(this.PersistenceMock.Object); this.PersistenceMock .Setup(p => p.Categories) .Returns(this.CategoryRepositoryMock.Object); var c = DefaultCategory(); this.CategoryRepositoryMock .Setup(r => r.FindById(c.Id)) .Returns(c); this.CategoryRepositoryMock .Setup(r => r.FindByParentAndName(c, "e")) .Returns(DefaultCategory()); var e = DefaultEntity(); var categoryNode = new CategoryNode(c); var node = new EntityNode(e); // ACT var result = Assert.Throws <InvalidOperationException>( () => node.MoveItem(this.ProviderContextMock.Object, "e", null, categoryNode)); // ASSERT Assert.Equal($"Destination container contains already a category with name '{e.Name}'", result.Message); }
/// <summary> /// ������ʵ�� /// </summary> /// <param name="pITable">���ݱ����</param> /// <param name="entinyNode">VCT�ռ�ʵ��ڵ�</param> public override void CreateFeature(ITable pITable, EntityNode entinyNode) { try { PointNode pPointNode = entinyNode as PointNode; if (pPointNode != null) { IFeatureClass pFeatureCls = pITable as IFeatureClass; this.Feature = pFeatureCls.CreateFeature(); ///��ʶ�븳ֵ int dBSMIndex = -1; dBSMIndex = this.Feature.Fields.FindField(m_strEntityIDFiled); if (dBSMIndex != -1) this.Feature.set_Value(dBSMIndex, pPointNode.EntityID); ///Ҫ�ش��븳ֵ int dSYDMIndex = -1; dSYDMIndex = this.Feature.Fields.FindField(m_strYSDMField); if (dSYDMIndex != -1) this.Feature.set_Value(dSYDMIndex, pPointNode.FeatureCode); IPoint pPoint = new PointClass(); pPoint.PutCoords(pPointNode.PointInfoNode.X, pPointNode.PointInfoNode.Y); (this.Feature as IFeature).Shape = pPoint; this.Feature.Store(); } } catch (Exception ex) { LogAPI.WriteErrorLog(ex); } }
public D3Element Flattern(EntityNode root) { //var nodes = [], i = 0; Stack <EntityNode> nodes = new Stack <EntityNode>(); int i = 0; ListCallback <EntityNode> recurse = null; recurse = delegate(EntityNode node, int index, IReadonlyCollection <EntityNode> list) { if (node.Children != null) { node.Children.ForEach(recurse); } if (node.Id == null) { i = i + 1; node.Id = i.ToString(); } nodes.Push(node); }; recurse(root, 0, null); return((D3Element)(object)nodes); //function recurse(node) { // if (node.children) node.children.forEach(recurse); // if (!node.id) node.id = ++i; // nodes.push(node); //} //recurse(root); //return nodes; }
public void EvaluateSpecificRule_DefaultDeny_ExpectDenyUpdate() { _securityOptions .Setup(x => x.DefaultSecurityRules) .Returns(SecurityOptions <FakeEntityContext> .CreateDefaultDenyRule()); var ruleId = Guid.NewGuid(); var entityId = Guid.NewGuid(); var node = new EntityNode { EntityId = entityId, IdPath = $"/{Guid.NewGuid()}/{Guid.NewGuid()}/{entityId}", }; var rules = new List <EntityNodeRuleContainer> { new EntityNodeRuleContainer(node, new EntitySecurityRule { Id = ruleId, EntityId = entityId, Rule = new SecurityRule { Right = SecurityRight.Read, Type = RuleType.Allow, Inherit = false, } }) }; var result = _matcher.EvaluateRule(node, rules, SecurityRight.Update); Assert.False(result.IsRightGranted); Assert.Equal(entityId, result.EntityId); Assert.Equal(SecurityRight.Update, result.AccessRight); Assert.NotNull(result.MatchedRule); Assert.Equal(Guid.Empty, result.MatchedRule.Id); }
public void EntityNode_provides_Item() { // ARRANGE var e = DefaultEntity(WithAssignedDefaultTag); e.SetFacetProperty(e.Tags.Single().Facet.Properties.Single(), "1"); // ACT var result = new EntityNode(e).GetItem(this.ProviderContextMock.Object); // ASSERT Assert.Equal(e.Id, result.Property <Guid>("Id")); Assert.Equal(e.Name, result.Property <string>("Name")); Assert.Equal(TreeStoreItemType.Entity, result.Property <TreeStoreItemType>("ItemType")); //todo: properties //Assert.Equal("t.p", result.Property<string[]>("Properties").Single()); Assert.IsType <EntityNode.Item>(result.ImmediateBaseObject); var assignedTag = result.Property <PSObject>("t"); Assert.IsType <AssignedTagNode.Item>(assignedTag.ImmediateBaseObject); Assert.Equal("1", assignedTag.Property <string>("p")); }
public LineEntity(EntityNode node) { this.Representation = node.Representation; this.FeatureCode = node.FeatureCode; this.EntityID = node.EntityID; //CreateFeature(node); }
public Enemy(Level level, SceneGraphNode node, Vector3 relativeStartPos, Bullet.Factory createBullet) { Node = node; node.AssociatedObject = this; this.level = level; this.createBullet = createBullet; player = level.LocalPlayer; bodyNode = Node.CreateChild(); bodyNode.Relative = Matrix.Scaling(2, 2, 2) * Matrix.RotationZ(-(float)Math.PI * 0.05f); var bodyEnt = level.CreateEntityNode(bodyNode.CreateChild()); bodyEnt.Mesh = TW.Assets.LoadMesh("Scattered\\Models\\EnemyRobotParts\\Body"); sightNode = bodyNode.CreateChild(); sightEnt = level.CreateEntityNode(sightNode.CreateChild()); sightEnt.Mesh = TW.Assets.LoadMesh("Scattered\\Models\\EnemyRobotParts\\Sight_red"); tailNode = bodyNode.CreateChild(); tailNode.Relative = Matrix.Translation(new Vector3(0, -0.05f, 0)); tailEnt = level.CreateEntityNode(tailNode.CreateChild()); tailEnt.Mesh = TW.Assets.LoadMesh("Scattered\\Models\\EnemyRobotParts\\Tail"); propellorAxesNode = bodyNode.CreateChild(); propellorAxesNode.Relative = Matrix.Translation(new Vector3(-0.02f, -0.05f, 0)); var axesEnt = level.CreateEntityNode(propellorAxesNode.CreateChild()); axesEnt.Mesh = TW.Assets.LoadMesh("Scattered\\Models\\EnemyRobotParts\\PropellorAxes"); propellorLeftNode = propellorAxesNode.CreateChild(); propellorLeftNode.Relative = Matrix.Translation(new Vector3(-0.02f, 0.212f, 0.585f)); propLeftEnt = level.CreateEntityNode(propellorLeftNode.CreateChild()); propLeftEnt.Mesh = TW.Assets.LoadMesh("Scattered\\Models\\EnemyRobotParts\\Propellor"); propellorRightNode = propellorAxesNode.CreateChild(); propellorRightNode.Relative = Matrix.Translation(new Vector3(-0.02f, 0.212f, -0.585f)); propRightEnt = level.CreateEntityNode(propellorRightNode.CreateChild()); propRightEnt.Mesh = TW.Assets.LoadMesh("Scattered\\Models\\EnemyRobotParts\\Propellor"); Node.Relative = Matrix.Translation(relativeStartPos + new Vector3(0, idleHeight, 0)); currentHeight = idleHeight; Vector3 s; Quaternion r; Node.Absolute.Decompose(out s, out r, out currentPos); currentRotation = new Vector3(); newPos = currentPos; newRotation = currentRotation; startLocation = currentPos + new Vector3(0, patrolHeight - idleHeight, 0); LocalBoundingBox = new Vector3(2, 2, 2).CenteredBoundingbox(); level.AddBehaviour(node, update); }
public EntityNodeRuleContainer(EntityNode ruleNode, EntitySecurityRule securityRule) { SecurityRule = securityRule; NodeIdPath = ruleNode.IdPath.Substring( 0, ruleNode.IdPath.IndexOf(ruleNode.EntityId.ToString()) + ruleNode.EntityId.ToString().Length ); }
/// <summary> /// Initializes a new instance of this class. /// </summary> public EntityFadeProcess(EntityNode node, int fromColor, int toColor, int duration) { _entity = node; ColorMethods.SplitColor(ColorFormats.A8R8G8B8, fromColor, out _fromColorRed, out _fromColorGreen, out _fromColorBlue, out _fromColorAlpha); ColorMethods.SplitColor(ColorFormats.A8R8G8B8, toColor, out _toColorRed, out _toColorGreen, out _toColorBlue, out _toColorAlpha); _duration = duration; _timer.Restart(); }
public ScatteredPlayer(Level level, SceneGraphNode node) { this.level = level; this.node = node; itemNode = level.CreateEntityNode(node.CreateChild().Alter(c => c.Relative = Matrix.Translation(0, -0.5f, -3))); Health = 1; }
public string GetXY(EntityNode node, decimal multipler) { int size = 0; Entity entity = ((Entity)node.SourceData); size = GetSize(node); return("-" + (size * multipler).ToString() + "px"); }
/// <summary> /// Initializes a new instance of this class. /// </summary> /// <param name="entity">Entity that will be following.</param> /// <param name="targetEntity">Entity that be followed.</param> /// <param name="bufferRadius">Buffer radius around target in which no movement is produced.</param> /// <param name="speed">Speed at which entity moves.</param> public EntityFollowProcess(EntityNode entity, EntityNode targetEntity, float bufferRadius, float speed) { _priority = 2; // Right at the start, before things start to move :P. _entity = entity; _targetEntity = targetEntity; _bufferZoneRadius = bufferRadius; _followSpeed = speed; }
/// <summary> /// Initializes a new instance of this class. /// </summary> /// <param name="startNode">Starting node of the path to follow.</param> /// <param name="entity">Entity to follow the path.</param> public PathFollowProcess(PathMarkerNode startNode, EntityNode entity) { _entity = entity; _startNode = startNode; _currentNode = startNode; AdvanceOneNode(); }
/// <summary> The try assert. </summary> /// <param name="context"> The context. </param> /// <param name="entityReference"> The entity reference. </param> /// <param name="right"> The right. </param> /// <param name="dependencies"> The dependencies. </param> /// <returns> The assertion. </returns> public bool TryAssert(OrganizationServiceContext context, EntityReference entityReference, CrmEntityRight right, CrmEntityCacheDependencyTrace dependencies) { EntityNode entity = null; this.ContentMapProvider.Using(map => map.TryGetValue(entityReference, out entity)); return(entity != null && this.TryAssert(context, entity.ToEntity(), right, dependencies)); }
public virtual void GetEntityNodeByDataRow(DataRow dataRow, ref EntityNode entityNode) { if (dataRow != null) { entityNode.EntityID = dataRow[FieldName_EntityID] == System.DBNull.Value ? -1 : Convert.ToInt32(dataRow[FieldName_EntityID]); entityNode.FeatureCode = dataRow[FieldName_FeatureCode] == System.DBNull.Value ? "" : dataRow[FieldName_FeatureCode].ToString(); entityNode.Representation = dataRow[FieldName_Representation] == System.DBNull.Value ? "" : dataRow[FieldName_Representation].ToString(); } }
/// <summary> /// ������ʵ�� /// </summary> /// <param name="pITable">���ݱ����</param> /// <param name="entinyNode">VCT�ռ�ʵ��ڵ�</param> public override void CreateFeature(ITable pITable, EntityNode entinyNode) { try { IFeatureClass pFeatureCls = pITable as IFeatureClass; this.Feature = pFeatureCls.CreateFeature(); LineNode pLineNode = entinyNode as LineNode; if (pLineNode != null) { ///��ʶ�븳ֵ int dBSMIndex = -1; dBSMIndex = this.Feature.Fields.FindField(m_strEntityIDFiled); if (dBSMIndex != -1) this.Feature.set_Value(dBSMIndex, pLineNode.EntityID); ///Ҫ�ش��븳ֵ int dSYDMIndex = -1; dSYDMIndex = this.Feature.Fields.FindField(m_strYSDMField); if (dSYDMIndex != -1) this.Feature.set_Value(dSYDMIndex, pLineNode.FeatureCode); ///�����ռ����� int dLineNodeCount = pLineNode.SegmentNodes.Count; IPointCollection pointCollection = new PolylineClass(); for (int i = 0; i < dLineNodeCount; i++) { //11��ʾ�������� if (Metadata.MetaDataFile.GraphConfig.GetGraphMark("LINETYPE", pLineNode.SegmentNodes[i].SegmentType.ToString()) == "BrokenLine") { BrokenLineNode pBLine = pLineNode.SegmentNodes[i] as BrokenLineNode; foreach (PointInfoNode pPointInfoNode in pBLine.PointInfoNodes) { IPoint pPoint = new PointClass(); pPoint.PutCoords(pPointInfoNode.X, pPointInfoNode.Y); object objType = Type.Missing; pointCollection.AddPoint(pPoint, ref objType, ref objType); } } else { //�������ʹ�������չ } } (this.Feature as IFeature).Shape = pointCollection as IGeometry; //feature.set_Value(); this.Feature.Store(); } } catch(Exception ex) { Logger.WriteErrorLog(ex); } }
/// <summary> /// ������ʵ�� /// </summary> /// <param name="entinyNode">VCT��ʵ��ڵ�</param> public override FeatureEntity CreateFeatureEntity(EntityNode entinyNode) { if (entinyNode is PolygonNode) { m_PolygonEntity = new PolygonEntity(); m_PolygonEntity.SetFeatureKeyFieldName(m_strEntityFieldName, m_strSYDMFieldName); m_PolygonEntity.CreateFeature(this.Table, entinyNode); return m_PolygonEntity; } return null; }
/// <summary> /// ������ʵ�� /// </summary> /// <param name="entinyNode">VCT��ʵ��ڵ�</param> public override FeatureEntity CreateFeatureEntity(EntityNode entinyNode) { if (entinyNode is LineNode) { m_LineEntity = new LineEntity(); m_LineEntity.SetFeatureKeyFieldName(m_strEntityFieldName, m_strSYDMFieldName); m_LineEntity.CreateFeature(this.Table, entinyNode); return m_LineEntity; } else return null; }
/// <summary> /// ����ע��ʵ�� /// </summary> /// <param name="pITable">���ݱ����</param> /// <param name="entinyNode">VCT�ռ�ʵ��ڵ�</param> public override void CreateFeature(ITable pITable, EntityNode entinyNode) { try { AnnotationNode pAnnotationNode = entinyNode as AnnotationNode; if (pAnnotationNode != null) { IFeatureClass pFeatureCls = pITable as IFeatureClass; this.Feature = pFeatureCls.CreateFeature(); ///��ʶ�븳ֵ int dBSMIndex = -1; dBSMIndex = this.Feature.Fields.FindField(m_strEntityIDFiled); if (dBSMIndex != -1) this.Feature.set_Value(dBSMIndex, pAnnotationNode.EntityID); ///Ҫ�ش��븳ֵ int dSYDMIndex = -1; dSYDMIndex = this.Feature.Fields.FindField(m_strYSDMField); if (dSYDMIndex != -1) this.Feature.set_Value(dSYDMIndex, pAnnotationNode.FeatureCode); IAnnotationFeature pAnnotationFeature = Feature as IAnnotationFeature; if (pAnnotationFeature != null) { /////ע�����ݸ�ֵ ITextElement pTextElement = new TextElementClass(); ITextSymbol pTextSymbol = new TextSymbolClass(); pTextSymbol.Angle = pAnnotationNode.Angle; pTextElement.Text = pAnnotationNode.Text; pTextElement.Symbol = pTextSymbol; pAnnotationFeature.Annotation = pTextElement as IElement; } IPoint pPoint = new PointClass(); pPoint.PutCoords(pAnnotationNode.PointLocation.X, pAnnotationNode.PointLocation.Y); (this.Feature as IFeature).Shape = pPoint; this.Feature.Store(); } } catch (Exception ex) { LogAPI.WriteErrorLog(ex); } }
protected virtual DataRow CreateRow(EntityNode entityNode) { if (m_pDataTable == null) { GetTableForAdd(); } if (m_pDataTable != null) { DataRow dataRow = m_pDataTable.NewRow(); dataRow[FieldName_EntityID] = entityNode.EntityID; dataRow[FieldName_FeatureCode] = entityNode.FeatureCode; dataRow[FieldName_Representation] = entityNode.Representation; return dataRow; } return null; }
/// <summary> /// ����ע��ʵ�� /// </summary> /// <param name="entinyNode">VCTע��ʵ��ڵ�</param> public override FeatureEntity CreateFeatureEntity(EntityNode entinyNode) { try { if (entinyNode is AnnotationNode) { m_AnnotationEntity = new AnnotationEntity(); m_AnnotationEntity.SetFeatureKeyFieldName(m_strEntityFieldName, m_strSYDMFieldName); m_AnnotationEntity.CreateFeature(this.Table, entinyNode); return m_AnnotationEntity; } else return null; } catch(Exception ex) { LogAPI.WriteErrorLog(ex); return null; } }
/// <summary> /// �����ռ�ʵ�� /// </summary> /// <param name="entinyNode">VCT�ռ�ʵ��ڵ�</param> public virtual FeatureEntity CreateFeatureEntity(EntityNode entinyNode) { return null; }
public EntityNodeViewModel(EntityNode graphItemObject, Invert.Core.GraphDesigner.DiagramViewModel diagramViewModel) : base(graphItemObject, diagramViewModel) { }
protected override void Visit(EntityNode entityNode) { }
/// <summary> /// ����Ҫ�� /// </summary> /// <param name="pITable">���ݱ����</param> /// <param name="entinyNode">VCT�ռ�ʵ��ڵ�</param> public virtual void CreateFeature(ITable pITable, EntityNode entinyNode) { }
protected override DataRow CreateRow(EntityNode entityNode) { DataRow dataRow = base.CreateRow(entityNode); if (dataRow != null) { PolygonNode polygonNode = entityNode as PolygonNode; if (polygonNode != null) { dataRow[FieldName_PolygonType] = polygonNode.PolygonType; dataRow[FieldName_X] = polygonNode.LablePointInfoNode.X; dataRow[FieldName_Y] = polygonNode.LablePointInfoNode.Y; dataRow[FieldName_ComposeType] = polygonNode.ComposeType; return dataRow; } } return null; }
protected override DataRow CreateRow(EntityNode entityNode) { DataRow dataRow = base.CreateRow(entityNode); if (dataRow != null) { LineNodeEx lineNodeEx = entityNode as LineNodeEx; if (lineNodeEx != null) { dataRow[FieldName_IsFromLine] = lineNodeEx.IsFromLine ? 1 : -1; dataRow[FieldName_IsReverse] = lineNodeEx.IsReverse ? 1 : -1; dataRow[FieldName_LineIndex] = lineNodeEx.LineIndex; dataRow[FieldName_OrtherLineNodeID] = lineNodeEx.OrtherIndexID; dataRow[FieldName_PolygonID] = lineNodeEx.PolygonID; //dataRow[FieldName_OrtherPolygonID] = lineNodeEx.OtherPolygonID; return dataRow; } } return null; }
public void AddRow(EntityNode entityNode) { DataRow dataRow = CreateRow(entityNode); m_pDataTable.Rows.Add(dataRow); }
/// <summary> /// ������ʵ�� /// </summary> /// <param name="pITable">���ݱ����</param> /// <param name="entinyNode">VCT�ռ�ʵ��ڵ�</param> public override void CreateFeature(ITable pITable, EntityNode entinyNode) { PolygonNode pPolygonNode = entinyNode as PolygonNode; if (pPolygonNode != null) { IFeatureClass pFeatureCls = pITable as IFeatureClass; this.Feature = pFeatureCls.CreateFeature(); ///��ʶ�븳ֵ int dBSMIndex = -1; dBSMIndex = this.Feature.Fields.FindField(m_strEntityIDFiled); if (dBSMIndex != -1) this.Feature.set_Value(dBSMIndex, pPolygonNode.EntityID); ///Ҫ�ش��븳ֵ int dSYDMIndex = -1; dSYDMIndex = this.Feature.Fields.FindField(m_strYSDMField); if (dSYDMIndex != -1) this.Feature.set_Value(dSYDMIndex, pPolygonNode.FeatureCode); //���������������� bool bGetGeometry = false;///ָʾ�Ƿ��ȡͼ������ ///�����ñ��ȡ�������InDireCoordinatePolygon��ʾ������깹�� if (Metadata.MetaDataFile.GraphConfig.GetGraphMark("POLYGONFEATURETYPE", pPolygonNode.PolygonType.ToString()) == "InDireCoordinatePolygon") { IGeometryCollection pGeoCollection = new PolygonClass(); IPointCollection pPtCollection = new RingClass(); ///���ü�ӹ���ķ�ʽLineStructPolygon��ʾ�����߹��� if (Metadata.MetaDataFile.GraphConfig.GetGraphMark("POLYGONTYPE", pPolygonNode.ComposeType.ToString()) == "LineStructPolygon") { for (int i = 0; i < pPolygonNode.LineNodes.Count; i++) { LineNodeEx pLineNodeEx = pPolygonNode.LineNodes[i]; if (pLineNodeEx == null) continue; ///��ʶ��Ϊ0��ʾ����ָ��ʶ if (pLineNodeEx.EntityID != 0) { IPoint pPrePoint=null; if (pPtCollection.PointCount > 0) pPrePoint = pPtCollection.get_Point(pPtCollection.PointCount-1); IPointCollection pPointCollection=GetPointCollection(pLineNodeEx, pPrePoint); if (pPointCollection != null) pPtCollection.AddPointCollection(pPointCollection); if (i == pPolygonNode.LineNodes.Count - 1) { IRing pRing = pPtCollection as IRing; pRing.Close();///�պϵ�ǰ�� object oTypeMissing = Type.Missing; pGeoCollection.AddGeometry(pRing as IGeometry, ref oTypeMissing, ref oTypeMissing); bGetGeometry = true; pPtCollection = new RingClass();///��յ㼯���� } } else///������ʶ��Ϊ0ʱ�պ�ͼ�� { IRing pRing = pPtCollection as IRing; pRing.Close();///�պϵ�ǰ�� object oTypeMissing = Type.Missing; pGeoCollection.AddGeometry(pRing as IGeometry, ref oTypeMissing, ref oTypeMissing); bGetGeometry = true; pPtCollection = new RingClass();///��յ㼯���� } } if (bGetGeometry) { (this.Feature as IFeature).Shape = pGeoCollection as IGeometry; } } } else if (pPolygonNode.PolygonType == 1) { } this.Feature.Store(); } }
protected override DataRow CreateRow(EntityNode entityNode) { DataRow dataRow = base.CreateRow(entityNode); if (dataRow != null) { LineNode lineNode = entityNode as LineNode; if (lineNode != null) { dataRow[FieldName_LineNodeID] = m_nNewIndexID++; dataRow[FieldName_LineType] = lineNode.LineType; if (lineNode.SegmentNodes != null) { if (lineNode.SegmentNodes.Count > 0) { BrokenLineNode line = lineNode.SegmentNodes[0] as BrokenLineNode; if (line != null && line.PointInfoNodes.Count >= 2) { dataRow[FieldName_X1] = line.PointInfoNodes[0].X; dataRow[FieldName_Y1] = line.PointInfoNodes[0].Y; dataRow[FieldName_X2] = line.PointInfoNodes[1].X; dataRow[FieldName_Y2] = line.PointInfoNodes[1].Y; } } } return dataRow; } } return null; }