Beispiel #1
0
        public XbimMatrix3D ToMatrix3D(ConcurrentDictionary <int, object> maps = null)
        {
            object transform;

            if (maps != null && maps.TryGetValue(EntityLabel, out transform)) //already converted it just return cached
            {
                return((XbimMatrix3D)transform);
            }
            if (RefDirection != null)
            {
                XbimVector3D v = RefDirection.XbimVector3D();
                v.Normalized();
                transform = new XbimMatrix3D(v.X, v.Y, 0, 0, v.Y, v.X, 0, 0, 0, 0, 1, 0, Location.X, Location.Y, 0, 1);
            }
            else
            {
                transform = new XbimMatrix3D(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, Location.X, Location.Y,
                                             Location.Z, 1);
            }
            if (maps != null)
            {
                maps.TryAdd(EntityLabel, transform);
            }
            return((XbimMatrix3D)transform);
        }
Beispiel #2
0
 internal override void SetXML(XmlElement xml, BaseClassIfc host, Dictionary <int, XmlElement> processed)
 {
     base.SetXML(xml, host, processed);
     if (mRefDirection > 0)
     {
         xml.AppendChild(RefDirection.GetXML(xml.OwnerDocument, "RefDirection", this, processed));
     }
 }
		internal override void SetXML(XmlElement xml, BaseClassIfc host, Dictionary<string, XmlElement> processed)
		{
			base.SetXML(xml, host, processed);
			if (Axis != null)
				xml.AppendChild(Axis.GetXML(xml.OwnerDocument, "Axis", this, processed));
			if (RefDirection != null)
				xml.AppendChild(RefDirection.GetXML(xml.OwnerDocument, "RefDirection", this, processed));
		}
        public override string GetStepParameters()
        {
            var parameters = new List <string>();

            parameters.Add(Location != null ? Location.ToStepValue() : "$");
            parameters.Add(RefDirection != null ? RefDirection.ToStepValue() : "$");

            return(string.Join(", ", parameters.ToArray()));
        }
 protected override void setJSON(JObject obj, BaseClassIfc host, SetJsonOptions options)
 {
     base.setJSON(obj, host, options);
     if (Axis != null)
     {
         obj["Axis"] = Axis.getJson(this, options);
     }
     if (RefDirection != null)
     {
         obj["RefDirection"] = RefDirection.getJson(this, options);
     }
 }
Beispiel #6
0
        public override void GetReferences(StackSourceSampleIndex nodeIndex, RefDirection dir, Action <StackSourceSampleIndex> callback)
        {
            NodeIndex index = (NodeIndex)nodeIndex;

            // This is the special node that represents 'orphans'.
            // TODO we simply give up for now.  This is OK because we only use GetRefs in places were we are AUGMENTING
            // the normal call tree (thus by returning nothing we just get the tree nodes).   You an imagine cases where
            // we really do need to report the correct data.
            if (index == m_graph.NodeIndexLimit)
            {
                return;
            }

            if (dir == RefDirection.From)
            {
                var node = m_graph.GetNode(index, AllocNodeStorage());
                for (var childIndex = node.GetFirstChildIndex(); childIndex != NodeIndex.Invalid; childIndex = node.GetNextChildIndex())
                {
                    callback((StackSourceSampleIndex)childIndex);
                }

                FreeNodeStorage(node);
            }
            else
            {
                Debug.Assert(dir == RefDirection.To);

                // Compute the references if we have not already done so.
                var refGraph = RefGraph;
                if (m_refNodeStorage == null)
                {
                    m_refNodeStorage = m_refGraph.AllocNodeStorage();
                }

                // If this code blows up, it could be because m_refNodeStorage is being reused inappropriately (reentrant)
                // Just make the storage a local var
                var node = refGraph.GetNode(index, m_refNodeStorage);
                for (var childIndex = node.GetFirstChildIndex(); childIndex != NodeIndex.Invalid; childIndex = node.GetNextChildIndex())
                {
                    callback((StackSourceSampleIndex)childIndex);
                }
            }
        }
Beispiel #7
0
        private XbimMatrix3D ConvertAxis3D()
        {
            if (RefDirection == null || Axis == null)
            {
                return(new XbimMatrix3D(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, Location.X, Location.Y,
                                        Location.Z, 1));
            }

            var za = Axis.XbimVector3D();

            za.Normalized();
            var xa = RefDirection.XbimVector3D();

            xa.Normalized();
            var ya = XbimVector3D.CrossProduct(za, xa);

            ya.Normalized();
            return(new XbimMatrix3D(xa.X, xa.Y, xa.Z, 0, ya.X, ya.Y, ya.Z, 0, za.X, za.Y, za.Z, 0, Location.X,
                                    Location.Y, Location.Z, 1));
        }
Beispiel #8
0
        public static StateObject CreateArrowStateObject(this ParserObject baseObject, ParserObject referenceObject = null, RefDirection refDirection = RefDirection.None)
        {
            var result = new StateObject();

            result.Parent             = baseObject;
            result.ObjectClass        = ObjectClass.ViewArrow;
            result.State              = State.ViewArrow;
            result.ReferenceObj       = referenceObject;
            result.ReferenceDirection = refDirection;
            result.Color              = ColorTranslator.ToHtml(Color.White);
            result.Description        = null;
            if (referenceObject != null)
            {
                result.ReferenceStateObj = referenceObject.StateCollection.LastOrDefault(x => x.ObjectClass != ObjectClass.ViewArrow && x.ObjectClass != ObjectClass.Blank);
            }

            return(result);
        }
 public override void GetReferences(StackSourceSampleIndex nodeIndex, RefDirection direction, Action <StackSourceSampleIndex> callback)
 {
     this.inner.GetReferences(nodeIndex, direction, callback);
 }