private void RootModified(Node node, AttributeInterpreterBase atttributetype)
 {
     if (atttributetype is LayerContainerInterpreter)
     {
         OnModified();
     }
 }
示例#2
0
 private void OnReferencedModified(Node node, AttributeInterpreterBase atttributeName)
 {
     if (!(atttributeName is TopoDsShapeInterpreter))
     {
         return;
     }
     OnModified();
 }
 private void OnReferencedModified(Node node, AttributeInterpreterBase atttributeType)
 {
     if (!(atttributeType is TopoDsShapeInterpreter || atttributeType is DrawingAttributesInterpreter))
     {
         return;
     }
     OnModified();
 }
        private void OnReferencedModified(Node node, AttributeInterpreterBase atttributeName)
        {
            if (!(atttributeName is TransformationInterpreter))
            {
                return;
            }

            RegenerateShape();
        }
        public void PreconditionCode(AttachedNodeData data, List <string> lines, AttributeInterpreterBase interpreter)
        {
            var builder     = new NodeBuilder(interpreter.Parent);
            var builderName = "builder" + builder.Node.Index;

            data.Data[AttachedDataNames.BuilderName] = builderName;
            lines.Add(builderName + "= NodeBuilder(Document, FunctionNames." + builder.FunctionName + ")");
            lines.Add(builderName + ".ShapeName =  \"" + builder.ShapeName + "\"");
        }
        public void PostHandle(AttributeInterpreterBase interpreter, AttachedNodeData data, List <string> lines)
        {
            var typeId = interpreter.GetType().GetHashCode();
            IHandleBooExportInterpreter item;

            if (!_handlers.TryGetValue(typeId, out item))
            {
                return;
            }
            item.PostconditionCode(data, lines);
        }
 private void OnReferencedModified(Node node, AttributeInterpreterBase atttributeName)
 {
     if ((atttributeName is DrawingAttributesInterpreter) ||
         (atttributeName is LayerVisibilityInterpreter) ||
         (atttributeName is TopoDsShapeInterpreter) ||
         (atttributeName is TransformationInterpreter)
         )
     {
         RegenerateInteractive();
     }
 }
 /// <summary>
 ///   On node changes calls the function's execute method
 /// </summary>
 /// <param name = "node">node that generates the change</param>
 /// <param name = "interpreterName">interpreter changed</param>
 private void Root_Label_OnModified(Node node, AttributeInterpreterBase interpreterName)
 {
     if (_lockUpdate)
     {
         return;
     }
     if (interpreterName is FunctionInterpreter)
     {
         return;
     }
     Node.Get <FunctionInterpreter>().Execute();
 }
        private void OnParentModified(Node node, AttributeInterpreterBase atttributeName)
        {
            if (_lockParent)
            {
                return;
            }
            var attrId = atttributeName.GetHashCode();

            if (_blackListAttributes.Contains(attrId))
            {
                _blackListAttributes.Add(attrId);
            }
        }
        public override void PreconditionCode(AttachedNodeData data, List <string> lines,
                                              AttributeInterpreterBase interpreter)
        {
            var builderStr = BuilderStr(data);

            if (string.IsNullOrEmpty(builderStr))
            {
                return;
            }
            var realInterpreter = (RealInterpreter)interpreter;

            lines.Add(builderStr + "Real =" + _(realInterpreter.Value));
        }
        private void Execute(Node node, AttributeInterpreterBase atttributeType)
        {
            var nodePoint = NodeBuilderUtils.GetNodePoint(Parent);

            if (nodePoint == null)
            {
                return;
            }
            var builder = new NodeBuilder(_node);
            var y       = builder[0].TransformedPoint3D.Y;
            var point   = (Point3D)nodePoint;

            point.Y = y;
            SetupPointCoordinate(point);
        }
        public override void PreconditionCode(AttachedNodeData data, List <string> lines,
                                              AttributeInterpreterBase interpreter)
        {
            base.PreconditionCode(data, lines, interpreter);
            var builderStr = BuilderStr(data);

            if (string.IsNullOrEmpty(builderStr))
            {
                return;
            }
            var referenceInterpreter = (ReferenceInterpreter)interpreter;

            DefineSse(lines, referenceInterpreter.Data);
            lines.Add(builderStr + "ReferenceData = sse");
        }
示例#13
0
        public override void PreconditionCode(AttachedNodeData data, List <string> lines,
                                              AttributeInterpreterBase interpreter)
        {
            var buildStr = BuilderStr(data);

            if (string.IsNullOrEmpty(buildStr))
            {
                return;
            }
            var nodeBuilder = new NodeBuilder(data.Parent.Node);

            var point = nodeBuilder[data.Node.Index - 1].TransformedPoint3D;

            lines.Add(buildStr + "Point3D = Point3D(" + _(point.X) + ", " + _(point.Y) + ", " + _(point.Z) + ")");
        }
        public override void PreconditionCode(AttachedNodeData data, List <string> lines,
                                              AttributeInterpreterBase interpreter)
        {
            var builderStr = BuilderStr(data);

            if (string.IsNullOrEmpty(builderStr))
            {
                return;
            }
            var axis = new Axis(new NodeBuilder(data.Parent.Node)[data.Node.Index - 1].TransformedAxis3D);

            lines.Add(builderStr + "Axis3D = Axis (" +
                      "Point3D(" + _(axis.Location.X) + ", " + _(axis.Location.Y) + ", " + _(axis.Location.Z) + ")," +
                      "Point3D(" + _(axis.Direction.X) + ", " + _(axis.Direction.Y) + ", " + _(axis.Direction.Z) + "))"
                      );
        }
        private void OnReferencedModified(Node node, AttributeInterpreterBase atttributeName)
        {
            var attrId = atttributeName.GetType().GetHashCode();

            if (_blackListAttributes.Contains(attrId))
            {
                return;
            }
            _lockParent = true;
            var data = _node.Interpreters[attrId].Serialize();

            if (!Parent.Interpreters.ContainsKey(attrId))
            {
                Parent.Interpreters[attrId] = AttributeInterpreterFactory.GetInterpreter(attrId, Parent);
            }
            Parent.Interpreters[attrId].Deserialize(data);
            _lockParent = false;

            OnModified();
        }
        public override void PreconditionCode(AttachedNodeData data, List <string> lines,
                                              AttributeInterpreterBase interpreter)
        {
            base.PreconditionCode(data, lines, interpreter);
            var builderStr = BuilderStr(data);

            if (string.IsNullOrEmpty(builderStr))
            {
                return;
            }
            var referenceListInterpreter = (ReferenceListInterpreter)interpreter;

            lines.Add("refList = List[of SceneSelectedEntity]()");
            foreach (var sceneSelectedEntity in referenceListInterpreter.Nodes)
            {
                DefineSse(lines, sceneSelectedEntity);
                lines.Add("refList.Add(sse)");
            }
            lines.Add(builderStr + "ReferenceList = refList");
        }
示例#17
0
        private void HandleModified(Node node, AttributeInterpreterBase atttributetype)
        {
            var shapeManager = Parent.Root.Set <DocumentContextInterpreter>().ShapeManager;

            shapeManager.UpdateNodesInteractive(Parent);
        }
示例#18
0
        private static void ModifyNodeWithDiff(NodeDiff diff, Node result)
        {
            if (diff.Applied)
            {
                return;
            }
            diff.Applied = true;

            foreach (var removedNode in diff.RemovedNodes)
            {
                if (diff.Children.ContainsKey(removedNode))
                {
                    diff.Children.Remove(removedNode);
                }
                result.Remove(removedNode);
            }

            foreach (var modifiedNode in diff.Children.Keys)
            {
                var childDiff = diff.Children[modifiedNode];
                if (!result.Children.ContainsKey(modifiedNode))
                {
                    result.AddChild(modifiedNode);
                }
                var childNode = result.Children[modifiedNode];

                ModifyNodeWithDiff(childDiff, childNode);
            }
            AttributeInterpreterBase functionInterpreter = null;
            AttributeData            attrData            = null;

            foreach (var modifiedAttr in diff.ModifiedAttributeData)
            {
                AttributeInterpreterBase interpreter;
                var key = AttributeInterpreterFactory.GetTypeId(modifiedAttr.Value.Name);
                if (!result.Interpreters.ContainsKey(key))
                {
                    interpreter = AttributeInterpreterFactory.GetInterpreter(key, result);
                    result.Interpreters[key] = interpreter;
                }
                else
                {
                    interpreter = result.Interpreters[modifiedAttr.Key];
                }
                try
                {
                    if (modifiedAttr.Value.Name == "Function")
                    {
                        functionInterpreter = interpreter;
                        attrData            = modifiedAttr.Value;
                        continue;
                    }
                    if (modifiedAttr.Key == typeof(ReferenceInterpreter).GetHashCode())
                    {
                        interpreter.Disable();
                        interpreter.Deserialize(modifiedAttr.Value);
                        var refNode = result.Get <ReferenceInterpreter>().Node;
                        DeserializeTargetNode(diff, result, refNode);
                        interpreter.Enable();
                    }

                    if (modifiedAttr.Key == typeof(ReferenceListInterpreter).GetHashCode())
                    {
                        interpreter.Disable();
                        interpreter.Deserialize(modifiedAttr.Value);
                        var refNodes = new List <SceneSelectedEntity>();
                        foreach (var refnode in result.Get <ReferenceListInterpreter>().Nodes)
                        {
                            refNodes.Add(refnode);
                        }

                        foreach (var refNode in refNodes)
                        {
                            DeserializeTargetNode(diff, result, refNode.Node);
                        }
                        interpreter.Enable();
                    }
                    interpreter.Deserialize(modifiedAttr.Value);
                }
                catch (Exception ex)
                {
                    var path            = AttributeData.RelativeReferencePath(result.Root, result);
                    var interpreterName = AttributeInterpreterFactory.GetName(modifiedAttr.Key);
                    Log.Info("Error on node: (" + path + ") interpreter: " + interpreterName
                             + Environment.NewLine + " Message: " + ex.Message
                             + Environment.NewLine + " Stack: " + ex.StackTrace);
                    //   throw;
                }
            }

            if (functionInterpreter != null)
            {
                functionInterpreter.Deserialize(attrData);
            }

            foreach (var removedAttr in diff.RemovedAttributes)
            {
                result.RemoveInterpreter(removedAttr);
            }
        }
 public abstract void PreconditionCode(AttachedNodeData data, List <string> lines,
                                       AttributeInterpreterBase interpreter);
示例#20
0
 public override void PreconditionCode(AttachedNodeData data, List <string> lines,
                                       AttributeInterpreterBase interpreter)
 {
     _data = data;
 }
示例#21
0
 private void OnReferencedModified(Node node, AttributeInterpreterBase atttributeType)
 {
     OnModified();
 }
示例#22
0
 private void OnModifiedEvent(Node node, AttributeInterpreterBase attributeName)
 {
     Mark();
 }