コード例 #1
0
ファイル: Forces.cs プロジェクト: rgatkinson/nadir
 public Force(GraphComponent component, IPhysicalObject target, double strength)
     {
     component.Forces.Add(this);
     this.component = component;
     this.target    = target;
     this.strength  = strength;
     this.time      = 0;
     }
コード例 #2
0
        /// <summary>
        ///
        /// </summary>
        private void Merge()
        {
            if (_mergedLineStrings != null)
            {
                return;
            }

            // reset marks (this allows incremental processing)
            GraphComponent.SetMarked(_graph.GetNodeEnumerator(), false);
            GraphComponent.SetMarked(_graph.GetEdgeEnumerator(), false);

            _edgeStrings = new List <EdgeString>();
            BuildEdgeStringsForObviousStartNodes();
            BuildEdgeStringsForIsolatedLoops();
            _mergedLineStrings = new List <Geometry>();
            foreach (var edgeString in _edgeStrings)
            {
                _mergedLineStrings.Add(edgeString.ToLineString());
            }
        }
コード例 #3
0
        private PartialDecomposition GetFirstComponent(PartialDecomposition decomposition)
        {
            var faces = decomposition.GetRemainingFaces();

            if (Faces.Count != 0)
            {
                List <TNode> firstFace;

                if (preferSmallCycles)
                {
                    var smallestFaceIndex = faces.MinBy(x => x.Count);
                    firstFace = faces[smallestFaceIndex];
                }
                else
                {
                    var largestFaceIndex = faces.MaxBy(x => x.Count);
                    firstFace = faces[largestFaceIndex];
                }

                var cycleComponent = new GraphComponent()
                {
                    Nodes      = firstFace,
                    IsFromFace = true,
                    MinimumNeighborChainNumber = 0,
                };

                logger.WriteLine("Starting with cycle");
                logger.WriteLine(cycleComponent);

                return(decomposition.AddChain(cycleComponent.Nodes, true));
            }

            var startingNode  = Graph.Vertices.First(x => Graph.GetNeighbours(x).Count() == 1);
            var treeComponent = GetTreeComponent(decomposition, startingNode);

            logger.WriteLine("Starting with tree");
            logger.WriteLine(treeComponent);

            return(decomposition.AddChain(treeComponent.Nodes, false));
        }
コード例 #4
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public virtual IList GetConnectedSubgraphs()
        {
            IList subgraphs = new ArrayList();

            GraphComponent.SetVisited(_graph.GetNodeEnumerator(), false);
            IEnumerator ienum = _graph.GetEdgeEnumerator();

            while (ienum.MoveNext())
            {
                Edge e = ienum.Current as Edge;
                if (e == null)
                {
                    throw new NullEdgeException();
                }
                Node node = e.GetDirEdge(0).FromNode;
                if (!node.IsVisited)
                {
                    subgraphs.Add(FindSubgraph(node));
                }
            }
            return(subgraphs);
        }
コード例 #5
0
        private static IEnumerable <DirectedEdge> FindSequence(Subgraph graph)
        {
            GraphComponent.SetVisited(graph.GetEdgeEnumerator(), false);

            var startNode = FindLowestDegreeNode(graph);

            var list = startNode.OutEdges.Edges;

            var ie = list.GetEnumerator();

            ie.MoveNext();

            var startDE    = ie.Current;
            var startDESym = startDE.Sym;

            var seq = new LinkedList <DirectedEdge>();
            var pos = AddReverseSubpath(startDESym, null, seq, false);

            while (pos != null)
            {
                var prev           = pos.Value;
                var unvisitedOutDE = FindUnvisitedBestOrientedDE(prev.FromNode);
                if (unvisitedOutDE != null)
                {
                    var toInsert = unvisitedOutDE.Sym;
                    pos = AddReverseSubpath(toInsert, pos, seq, true);
                }
                else
                {
                    pos = pos.Previous;
                }
            }

            /*
             * At this point, we have a valid sequence of graph DirectedEdges, but it
             * is not necessarily appropriately oriented relative to the underlying geometry.
             */
            return(Orient(seq /*new ArrayList(seq.CastPlatform())*/));
        }
コード例 #6
0
    public override void setUp(GraphComponent passiveComponent)
    {
        this.graphComponent = passiveComponent;

        GameObject middle = this.transform.Find("Middle").gameObject;

        if (passiveComponent.GetType() == typeof(Reflector))
        {
            GameObject mirrorBasePrefab = (GameObject)SceneResouces.SceneObjects["Default"][typeof(GameObject)]["MirrorBase"];

            GameObject back = GameObject.Instantiate(mirrorBasePrefab);
            //back.GetComponent<PolygonCollider2D>().enabled = true;
            back.transform.SetParent(this.transform, false);

            middle.AddComponent <MirrorController>();
        }
        else
        {
            middle.AddComponent <PassingMirrorController>();
        }

        this.transform.rotation = Quaternion.Euler(new Vector3(0, 0, -45) + this.transform.rotation.eulerAngles);
    }
コード例 #7
0
ファイル: Rendering.cs プロジェクト: rgatkinson/nadir
    //----------------------------------------------------------------------------------------
    // Construction
    //----------------------------------------------------------------------------------------

    public GraphVertex(GraphComponent component, string displayName, Domain d) 
        {
        this.Visualization = new VisualGraphVertex(component, new PointD(0,0));
        this.Visualization.PhysicalObject = this;
        this.domain = d;
        this.DisplayName = displayName;
        component.Vertices.Add(this);

        component.PhysicalObjects.Add(this);

        this.Visualization.IsSelectable = true;

        new FrictionalForce    (component, this, Constants.CoefficientOfFriction, Constants.FrictionPower);
        new CoolingThermalNoise(component, this, Constants.ThermalStrength, Constants.ThermalDuration);
        //
        foreach (IPhysicalObject p in component.PhysicalObjects)
            {
            GraphVertex v = p as GraphVertex;
            if (null != v && v != this /* && v.domain.Strand != this.domain.Strand */)
                {
                new ReplusiveForce(component, this, p, Constants.RepulsiveForceStrength);
                }
            }
        }
コード例 #8
0
ファイル: Forces.cs プロジェクト: rgatkinson/nadir
 public ReplusiveForce(GraphComponent component, IPhysicalObject target, IPhysicalObject reference, double strength, double degree = -2) : base(component,target,strength)
     {
     this.reference = reference;
     this.degree    = degree;
     }
コード例 #9
0
    private List <Receiver> getConnections(int currentBounces, int maxBounces, ComponentPiece currentPiece, int rotation)
    {
        //passes in a piece and the sees it it connects to a reciever eventually.

        //stores all of the recievers connected to
        List <Receiver> result = new List <Receiver>();


        List <LightComponent> components = this.lightGraph.getAllGraphComponents();

        //default to rotation 0
        Func <ComponentPiece, ComponentPiece, bool> selector = (closestPiece, checkingPiece) =>
        {
            //gets the smallest y value
            bool isCloser = false;
            if (closestPiece == null || (checkingPiece.Rect.y < closestPiece.Rect.y))
            {
                isCloser = true;
            }
            return(isCloser);
        };

        if (rotation == 1)
        {
            selector = (closestPiece, checkingPiece) =>
            {
                //gets the smallest x value
                bool isCloser = false;
                if (closestPiece == null || (checkingPiece.Rect.x < closestPiece.Rect.x))
                {
                    isCloser = true;
                }
                return(isCloser);
            };
        }
        else if (rotation == 2)
        {
            selector = (closestPiece, checkingPiece) =>
            {
                //gets the biggest y value
                bool isCloser = false;
                if (closestPiece == null || (checkingPiece.Rect.y > closestPiece.Rect.y))
                {
                    isCloser = true;
                }
                return(isCloser);
            };
        }
        else if (rotation == 3)
        {
            selector = (closestPiece, checkingPiece) =>
            {
                //gets the biggest x value
                bool isCloser = false;
                if (closestPiece == null || (checkingPiece.Rect.x > closestPiece.Rect.x))
                {
                    isCloser = true;
                }
                return(isCloser);
            };
        }

        Rect ray = getRayRect((Direction)rotation, currentPiece.Rect, new Vector2(.2f, getMaxRayLength()));

        GraphComponent currentClosestComponent = null;
        ComponentPiece currentClosestPiece     = null;

        //gets the closest piece it collides with
        //goes through each component
        for (int c = 0; c < components.Count; c++)
        {
            GraphComponent        currentComponent = components[c];
            List <ComponentPiece> pieces           = currentComponent.ComponentPieces;

            //loops though all the pieces
            for (int p = 0; p < pieces.Count; p++)
            {
                //checks if overlaps with ray and is closer
                if (ray.Overlaps(pieces[p].Rect))
                {
                    if (selector(currentClosestPiece, pieces[p]))
                    {
                        currentClosestPiece     = pieces[p];
                        currentClosestComponent = currentComponent;
                    }
                }
            }
        }

        if (currentClosestPiece != null && currentBounces < LightGraph.maxBounces)
        {
            if (currentClosestPiece.GetType() == typeof(Mirror))
            {
                //reflect off of the mirror
                Direction newDirection = reflect((Direction)rotation, currentClosestComponent.Rotation, currentClosestComponent.Flipped);

                //adds the result from the next beam to this list
                result.AddRange(getConnections(currentBounces++, LightGraph.maxBounces, currentClosestPiece, (int)newDirection));
            }
            else if (currentClosestPiece.GetType() == typeof(PassingMirror))
            {
                //goes through the passing mirror
                result.AddRange(getConnections(currentBounces++, LightGraph.maxBounces, currentClosestPiece, rotation));

                //reflects off the passing mirror
                Direction newDirection = reflect((Direction)rotation, currentClosestComponent.Rotation, currentClosestComponent.Flipped);
                result.AddRange(getConnections(currentBounces++, LightGraph.maxBounces, currentClosestPiece, (int)newDirection));
            }
            else if (currentClosestPiece.GetType().IsSubclassOf(typeof(Receiver)))
            {
                result.Add((Receiver)currentClosestPiece);
            }
        }

        return(result);
    }
コード例 #10
0
ファイル: Forces.cs プロジェクト: rgatkinson/nadir
 public CoolingThermalNoise(GraphComponent component, IPhysicalObject target, double strength, double decayDuration) : base(component,target,strength)
     {
     this.decayDuration = decayDuration;
     }
コード例 #11
0
ファイル: Rendering.cs プロジェクト: rgatkinson/nadir
    void WireHydrogenBond(GraphComponent component, Domain d, GraphVertex from, GraphVertex to, GraphVertex fromAux, GraphVertex toAux)
        {
        if (!WiredHydrogenBondsOf(from).Contains(to))
            {
            Debug.Assert(!WiredHydrogenBondsOf(to).Contains(from));
            WiredHydrogenBondsOf(from).Add(to);
            WiredHydrogenBondsOf(to).Add(from);

            double length = this.HydrogenBondLength(d, d.Connection);
            GraphEdge edge = new GraphEdge(component, from, to, length, Constants.StyleLineHydrogenBond);
            // edge.Visualization.Shaft = VisualGraphEdge.SHAFT.Full;   // we don't show the end line of domains as we now shade the double stranded region entirely

            SpringForce.CreateSymmetricalSpringForces(component, edge.A, edge.B, Constants.SpringConstantHydrogenBond, length);
            IntersectionForce.Create(component, edge, Constants.IntersectionForceStrength);

            new RightAngleForce(component, fromAux, from, to,   Constants.RightAngleStrength);
            new RightAngleForce(component, toAux,   to,   from, Constants.RightAngleStrength); 
            }
        }
コード例 #12
0
ファイル: Rendering.cs プロジェクト: rgatkinson/nadir
 GraphComponent ComposeRendering(Plex plex)
 // Strategy: compose the component strands individually. Then connect the hydrogen bonds.
     {
     // Each plex forms a (new) component of the graph
     //
     GraphComponent component = new GraphComponent(this);
     //
     // Compose each strand. For starters, we place them vertically one atop another.
     //
     double y = 0;
     foreach (Strand strand in plex.CanonicallyOrderedStrands)
         {
         this.ComposeRendering(component, strand, y);
         y += Constants.StrandRenderingInitialDY;
         }
     //
     // Hydrogen bonds within the plex will need additional visualization
     // 
     WireHydrogenBonds(component, plex.AllStrands());
     //
     return component;
     }
コード例 #13
0
ファイル: Forces.cs プロジェクト: rgatkinson/nadir
 public static void Create(GraphComponent component, GraphEdge eNew, double strength)
     {
     if (strength != 0)
         {
         foreach (GraphEdge eExist in component.Edges)
             {
             if (eExist != eNew && !eExist.IncidentTo(eNew))
                 {
                 new IntersectionForce(component, eExist.A, strength, eExist, eNew, eNew.A);
                 new IntersectionForce(component, eNew.A,   strength, eExist, eNew, eExist.A);
                 //
                 new IntersectionForce(component, eExist.B, strength, eExist, eNew, eNew.B);
                 new IntersectionForce(component, eNew.B,   strength, eExist, eNew, eExist.B);
                 }
             }
         }
     }
コード例 #14
0
        /// <summary>
        /// Label an isolated node with its relationship to the target point.
        /// </summary>
        /// <param name="n"></param>
        /// <param name="targetIndex"></param>
        private void LabelIsolatedNode(GraphComponent n, int targetIndex)
        {
            LocationType loc = _ptLocator.Locate(n.Coordinate, _arg[targetIndex].Geometry);

            n.Label.SetAllLocations(targetIndex, loc);
        }
コード例 #15
0
 public void removeComponent(GraphComponent component)
 {
     attachedComponents.Remove(component);
 }
コード例 #16
0
        public void LoadGraphComponents(Overlap overlap)
        {
            double interModalPValue = ((double)overlap.RightTailOverlapCount) / ((double)overlap.Permutations);

            InterModalPValue = interModalPValue.ToString("0.000");

            List <ROIVertex> nodes = new List <ROIVertex>();
            List <GraphEdge> edges = new List <GraphEdge>();

            double xRange = _dataManager.XMax - _dataManager.XMin;
            double yRange = _dataManager.YMax - _dataManager.YMin;
            double zRange = _dataManager.ZMax - _dataManager.ZMin;

            for (var i = 0; i < 90; i++)
            {
                ROI roi = _dataManager.GetROI(i);

                double xFactor = (roi.X - _dataManager.XMin) / xRange;
                double yFactor = (roi.Y - _dataManager.YMin) / yRange;
                double zFactor = (roi.Z - _dataManager.ZMin) / zRange;

                nodes.Add(new ROIVertex()
                {
                    Roi = roi, XF = xFactor, YF = yFactor, ZF = zFactor
                });
            }

            foreach (var node in overlap.Vertices)
            {
                var nd = nodes[node.Id];
                nd.Highlight = true;

                InterModalNodes.Add(new NodeResult()
                {
                    Id = nd.Roi.Index, Name = nd.Roi.Name, Count = node.RandomOverlapCount.ToString("0")
                });
            }

            foreach (var cmpList in overlap.Components.Values)
            {
                int            cmpSize = 0;
                GraphComponent cmp     = null;
                for (var i = 0; i < cmpList.Count; i++)
                {
                    if (cmpList[i].Edges.Count > cmpSize)
                    {
                        cmp     = cmpList[i];
                        cmpSize = cmp.Edges.Count;
                    }
                }

                for (var i = 0; i < cmp.Edges.Count; i++)
                {
                    var edge = cmp.Edges[i];

                    if (nodes[edge.V1].Highlight && nodes[edge.V2].Highlight)
                    {
                        edge.Color = overlap.Colors[cmp.DataType];
                        edges.Add(edge);

                        ROIVertex v1 = nodes[edge.V1];
                        ROIVertex v2 = nodes[edge.V2];

                        double diff = edge.M2 - edge.M1;
                        double pval = ((double)edge.RightTailCount) / ((double)overlap.Permutations);

                        InterModalEdges.Add(new EdgeResult()
                        {
                            V1 = v1.Roi.Name, V2 = v2.Roi.Name, Diff = diff, TStat = edge.TStat, PVal = pval
                        });
                    }
                }
            }

            //_graphCrXL.SetData(nodes, edges,
            //		r => new ROIDim() { Raw = r.Roi.X, Factor = r.XF }, xRange, _dataManager.XMin, _dataManager.XMax,
            //		r => new ROIDim() { Raw = r.Roi.Z, Factor = r.ZF }, zRange, _dataManager.ZMin, _dataManager.ZMax,
            //		false, ComponentColor, overlap);

            //_graphSgXL.SetData(nodes, edges,
            //	r => new ROIDim() { Raw = r.Roi.X, Factor = r.XF }, xRange, _dataManager.XMin, _dataManager.XMax,
            //	r => new ROIDim() { Raw = r.Roi.Y, Factor = r.YF }, yRange, _dataManager.YMin, _dataManager.YMax,
            //	false, ComponentColor, overlap);

            //_graphAxXL.SetData(nodes, edges,
            //	r => new ROIDim() { Raw = r.Roi.Y, Factor = r.YF }, yRange, _dataManager.YMin, _dataManager.YMax,
            //	r => new ROIDim() { Raw = r.Roi.Z, Factor = r.ZF }, zRange, _dataManager.ZMin, _dataManager.ZMax,
            //	true, ComponentColor, overlap);

            //_graphCrXL.Draw();
            //_graphSgXL.Draw();
            //_graphAxXL.Draw();
        }
コード例 #17
0
ファイル: Forces.cs プロジェクト: rgatkinson/nadir
 public static void CreateSymmetricalSpringForces(GraphComponent component, IPhysicalObject a, IPhysicalObject b, double k, double l)
 // Create the pair of forces that act on both ends of a conceptual spring
     {
     new SpringForce(component, a, k, l, b);
     new SpringForce(component, b, k, l, a);
     }
コード例 #18
0
ファイル: Forces.cs プロジェクト: rgatkinson/nadir
 public SpringForce(GraphComponent component, IPhysicalObject target, double k, double l, IPhysicalObject reference) : base(component, target, k)
     {
     this.equilibriumLength = l;
     this.reference = reference;
     }
コード例 #19
0
ファイル: Forces.cs プロジェクト: rgatkinson/nadir
 public UserDraggingForce(GraphComponent component, IPhysicalObject target, double strength) : base(component,target,strength)
     {
     }
コード例 #20
0
ファイル: Forces.cs プロジェクト: rgatkinson/nadir
 public static void Diagnose(GraphComponent component)
     {
     MiscUtil.TraceLine($"{component.Edges.Count} egdges");
     foreach (GraphEdge a in component.Edges)
         {
         if (a.IsIntersected())
             {
             MiscUtil.TraceLine($"{a} is intersected");
             foreach (GraphEdge b in component.Edges)
                 {
                 if (a != b && !a.IncidentTo(b))
                     {
                     if (a.Intersects(b))
                         MiscUtil.TraceLine($"    by {b}");
                     }
                 }
             }
         }
     }
コード例 #21
0
ファイル: Rendering-Drawing.cs プロジェクト: rgatkinson/nadir
    //
    //----------------------------------------------------------------------------------------
    // Construction
    //----------------------------------------------------------------------------------------

    public VisualDoubleStrandedRegion(GraphComponent component,
            VisualStrand vStrandTop,
            int iTopControlFirst,
            int iTopControlLast,
            VisualStrand vStrandBottom,
            int iBottomControlFirst,
            int iBottomControlLast,
            int cNt
            ) : base(component)
        {
        Debug.Assert(iTopControlFirst < iTopControlLast);
        Debug.Assert(iBottomControlFirst < iBottomControlLast);
        //
        this.vStrandTop    = vStrandTop;
        this.vStrandBottom = vStrandBottom;
        //
        this.iTopControlFirst = iTopControlFirst;
        this.iTopControlLast  = iTopControlLast;
        this.iBottomControlFirst = iBottomControlFirst;
        this.iBottomControlLast  = iBottomControlLast;
        //
        this.cNt = cNt;
        //
        this.SetStyleName(Constants.StyleDoubleStranded);  // default
        component.AddRenderable(this);
        }
コード例 #22
0
ファイル: Forces.cs プロジェクト: rgatkinson/nadir
 public RightAngleForce(GraphComponent component, IPhysicalObject a, IPhysicalObject target, IPhysicalObject b, double strength) : base(component, target, strength)
     {
     this.a = a;
     this.b = b;
     }
コード例 #23
0
ファイル: Rendering.cs プロジェクト: rgatkinson/nadir
 GraphComponent ComposeRendering(GraphComponent component, Strand strand, double y0 = 0)
 // We render a strand as a linear sequence of spring-separated particles.
 // We initially lay things out in a linear line, either to the right (for 
 // normally oriented strands) or left (for reverse oriented strands).
     {
     if (null==component)
         component = new GraphComponent(this);
     //
     // Compose edges for domains along the strand backbone
     // 
     List<GraphVertex> strandVertices = new List<GraphVertex>();
     List<GraphEdge>   strandEdges    = new List<GraphEdge>();
     //
     double count  = strand.AllDomains().Count();
     double length = strand.AllDomains().Sum(d => this.EdgeFromDomain(component, d).PreferredLength);
     double radius = length / 2.0 / Math.PI;
     //
     radius /= 3; // hack -> otherwise the forces pulling the circle together overshoot
     //
     int i = 0;
     foreach (Domain d in strand.AllDomains())
         {
         GraphEdge edge = this.EdgeFromDomain(component, d);
         strandEdges.Add(edge);
         //
         // The first vertex in the strand needs to be explicitly positioned
         //
         double x,y;
         //
         if (strandVertices.IsEmpty())
             {
             strandVertices.Add(edge.A);
             if (strand.IsCircular)
                 x = strand.Orientation==Strand.Direction.FiveToThree ? -radius : radius;
             else
                 x = 0;
             edge.A.SetLocation(x,y0);
             }
         //
         // Position the B vertex of the edge
         //
         if (strand.IsCircular)
             {
             double theta = i / count * 2 * Math.PI;
             x = radius * Math.Cos(theta);
             y = radius * Math.Sin(theta);
             if (strand.Orientation==Strand.Direction.FiveToThree)
                 {
                 x = -x;
                 y = -y;
                 }
             }
         else
             {
             y = y0; 
             x = edge.PreferredLength;
             if (strand.Orientation == Strand.Direction.ThreeToFive)
                 x = -x;
             x += strandVertices.Last().Location.X;
             }
         //
         edge.B.SetLocation(x, y);
         strandVertices.Add(edge.B);
         //
         i++;
         }
     //
     // Make a spline for the strand as a whole
     // 
     if (strandVertices.NotEmpty())
         {
         VisualStrand vStrand = new VisualStrand(strand, component, strandEdges, strandVertices);
         this.mpStrandVisualization[strand] = vStrand;
         //
         // Place ticks at the ends of each of the interior domains in the strand
         //
         for (i = strand.IsCircular ? 0 : 1; i < strandVertices.Count-1; i++)
             {
             new VisualDomainEndTick(component, vStrand, i, Constants.DomainEndLength);
             }
         //
         // Add domain labels and nucleotides
         //
         foreach (Domain d in strand.AllDomains())
             {
             i = d.StrandIndex;
             //
             VisualStrandLabel label = new VisualStrandLabel(component, vStrand, i, i+1, d.FullDisplayName, Constants.StyleDomainLabel);
             label.LabelType = VisualStrandLabel.LABELTYPE.DOMAIN;
             vStrand.NoteDomainLabel(i, label);
             //
             if (d.Nucleotides.Length > 0 && true)
                 {
                 label = new VisualStrandLabel(component, vStrand, i, i+1, d.Nucleotides, Constants.StyleNucleotides);
                 label.LabelType = VisualStrandLabel.LABELTYPE.NUCLEOTIDE;
                 label.FontVerticallyCentered = true;
                 label.AutoReverseText = true;
                 }
             }
         }
     //
     if (strandVertices.NotEmpty())
         {
         // Help a bit with initial placement: left align if we moved leftward
         // from zero due to strand direction.
         //
         if (!strand.IsCircular && strand.Orientation == Strand.Direction.ThreeToFive)
             {
             double dx = -strandVertices.Last().Location.X;
             foreach (GraphVertex v in strandVertices)
                 {
                 v.TranslateBy(dx, 0);
                 }
             }
         }
     //
     // Put in stiffness along the strand
     //
     foreach (Domain d in strand.AllDomains())
         {
         if (d.CircularNextTo5 != null)
             {
             GraphEdge curEdge  = this.EdgeFromDomain(component, d);
             GraphEdge prevEdge = this.EdgeFromDomain(component, d.CircularNextTo5);
             //
             new StraighteningForce(component, prevEdge.A, curEdge.A, curEdge.B, Constants.StraighteningStrength);
             }
         }
     //
     return component;
     }
コード例 #24
0
ファイル: Forces.cs プロジェクト: rgatkinson/nadir
 public FrictionalForce(GraphComponent component, IPhysicalObject target, double k, double degree = 0) : base(component, target, k)
     {
     this.degree = degree;
     }
コード例 #25
0
ファイル: Forces.cs プロジェクト: rgatkinson/nadir
 public IntersectionForce(GraphComponent component, IPhysicalObject target, double strength, GraphEdge a, GraphEdge b, IPhysicalObject reference) : base(component,target,strength)
     {
     this.a = a;
     this.b = b;
     this.reference = reference;
     }
コード例 #26
0
 public void addComponent(GraphComponent component)
 {
     attachedComponents.Add(component);
 }
コード例 #27
0
 public abstract void setUp(GraphComponent graphComponent);
コード例 #28
0
ファイル: Rendering.cs プロジェクト: rgatkinson/nadir
    //----------------------------------------------------------------------------------------
    // Construction
    //----------------------------------------------------------------------------------------

    public GraphEdge(GraphComponent component, GraphVertex a, GraphVertex b, double length, string style)
        {
        a.Edges.Add(this);
        b.Edges.Add(this);
        component.Edges.Add(this);

        this.Component = component;
        this.A = a;
        this.B = b;
        this.PreferredLength = length;
        }
コード例 #29
0
        public void Handle(NBSResultsAvailable message)
        {
            var overlap = _computeService.GetResults();
            var regions = _regionService.GetRegionsByIndex();

            var rvms = new List <RegionalViewModel>();

            foreach (var region in regions)
            {
                RegionalViewModel rvm = new RegionalViewModel
                {
                    ROI = region,
                };

                rvms.Add(rvm);
            }

            if (DataType != "overlap")
            {
                var cmps = overlap.Components[DataType];
                if (cmps != null)
                {
                    int            cmpSize = 0;
                    GraphComponent cmp     = null;
                    for (var i = 0; i < cmps.Count; i++)
                    {
                        if (cmps[i].Edges.Count > cmpSize)
                        {
                            cmp     = cmps[i];
                            cmpSize = cmp.Edges.Count;

                            cmp.DataType = DataType;
                        }
                    }

                    if (cmp != null)
                    {
                        Dictionary <int, Vertex> interModalVerts = new Dictionary <int, Vertex>();
                        foreach (var vtx in overlap.Vertices)
                        {
                            interModalVerts[vtx.Id] = vtx;
                        }

                        Dictionary <int, int> cmpVerts = new Dictionary <int, int>();

                        foreach (var edge in cmp.Edges)
                        {
                            var v1 = rvms[edge.V1];
                            var v2 = rvms[edge.V2];

                            cmpVerts[edge.V1] = edge.V1;
                            cmpVerts[edge.V2] = edge.V2;

                            double diff = edge.M1 - edge.M2;
                            double pval = ((double)edge.RightTailCount) / ((double)overlap.Permutations);

                            CmpEdges.Add(new EdgeResult {
                                V1 = v1.ROI.Name, V2 = v2.ROI.Name, Diff = diff, PVal = pval
                            });
                        }

                        AXPlotModel = LoadGraph(rvms, cmpVerts, cmp.Edges, r => r.X, r => r.Y);
                        SGPlotModel = LoadGraph(rvms, cmpVerts, cmp.Edges, r => (100 - r.Y), r => r.Z);
                        CRPlotModel = LoadGraph(rvms, cmpVerts, cmp.Edges, r => r.X, r => r.Z);

                        CmpPValue = "p" + (((double)cmp.RightTailExtentCount) / ((double)overlap.Permutations)).ToString("0.0000");

                        var itms = from v in cmpVerts.Values orderby v select v;
                        foreach (var vert in itms)
                        {
                            if (!interModalVerts.ContainsKey(vert))
                            {
                                CmpNodes.Add(new NodeResult()
                                {
                                    Name = rvms[vert].ROI.Name, Id = rvms[vert].ROI.Index
                                });
                            }
                        }
                    }
                }
            }
            else
            {
                Dictionary <int, int> cmpVerts = new Dictionary <int, int>();

                var nodes = from v in overlap.Vertices orderby v.Id select v;
                foreach (var node in nodes)
                {
                    cmpVerts[node.Id] = node.Id;
                    CmpNodes.Add(new NodeResult()
                    {
                        Name = rvms[node.Id].ROI.Name, Id = rvms[node.Id].ROI.Index, Count = node.RandomOverlapCount.ToString()
                    });
                }

                AXPlotModel = LoadGraph(rvms, cmpVerts, null, r => r.X, r => r.Y);
                SGPlotModel = LoadGraph(rvms, cmpVerts, null, r => (100 - r.Y), r => r.Z);
                CRPlotModel = LoadGraph(rvms, cmpVerts, null, r => r.X, r => r.Z);

                CmpPValue = "p" + (((double)overlap.RightTailOverlapCount) / ((double)overlap.Permutations)).ToString("0.0000");
            }
        }
コード例 #30
0
ファイル: Rendering.cs プロジェクト: rgatkinson/nadir
 GraphEdge EdgeFromDomain(GraphComponent component, Domain d, bool fMustExist=false)
 // Return the edge for the indicated domain along its strand. We create this 
 // edge if it doesn't already exist. The returned edge has edge.A on the 5'
 // side of d and edge.B on the 3' side.
     {
     GraphEdge edge;
     if (!this.mpDomainEdge.TryGetValue(d, out edge))
         {
         Debug.Assert(!fMustExist);
         //
         // If there's another domain 5' of this one, and he already has
         // an edge, then we use the B vertex from that guy; otherwise,
         // we make one fresh anew.
         //
         GraphVertex to5 = null;
         if (d.CircularNextTo5 != null)
             {
             GraphEdge edgeTo5;
             if (this.mpDomainEdge.TryGetValue(d.CircularNextTo5, out edgeTo5))
                 {
                 to5 = edgeTo5.B;
                 }
             }
         if (null == to5)
             {
             to5 = new GraphVertex(component, "[" + d.DisplayName + ">", d);
             }
         //  
         // Ditto, but in the 3' direction
         //
         GraphVertex to3 = null;
         if (d.CircularNextTo3 != null)
             {
             GraphEdge edgeTo3;
             if (this.mpDomainEdge.TryGetValue(d.CircularNextTo3, out edgeTo3))
                 {
                 to3 = edgeTo3.A;
                 }
             }
         if (null == to3)
             {
             to3 = new GraphVertex(component, "<" + d.DisplayName + "]", d);
             }
         //
         // Make the new edge
         //
         double length = this.DomainRenderingLength(d);
         edge = new GraphEdge(component, to5, to3, length, Constants.StyleLineDomain);
         //
         // Apply appropriate forces to the edge
         // 
         SpringForce.CreateSymmetricalSpringForces(component, edge.A, edge.B, Constants.SpringConstantDomain, length);
         IntersectionForce.Create(component, edge, Constants.IntersectionForceStrength);
         //
         // Remember this edge
         //
         edge.Domain = d;
         this.mpDomainEdge[d] = edge;
         }
     return edge;
     }
コード例 #31
0
        /// <summary>
        /// Label an isolated node with its relationship to the target point.
        /// </summary>
        private void LabelIncompleteNode(GraphComponent n, int targetIndex)
        {
            var loc = ptLocator.Locate(n.Coordinate, arg[targetIndex].Geometry);

            n.Label.SetLocation(targetIndex, loc);
        }
コード例 #32
0
ファイル: Rendering.cs プロジェクト: rgatkinson/nadir
 GraphComponent ComposeRendering(Strand strand)
     {
     GraphComponent component = new GraphComponent(this);
     this.ComposeRendering(component, strand, 0);
     WireHydrogenBonds(component, strand.AllStrands());
     return component;
     }
コード例 #33
0
ファイル: Rendering-Drawing.cs プロジェクト: rgatkinson/nadir
    //----------------------------------------------------------------------------------------
    // Construction
    //----------------------------------------------------------------------------------------

    public VisualStrandLabel(GraphComponent component,
            VisualStrand vStrand,
            int iControlFirst,
            int iControlLast,
            string text,
            string style
            ) : base(component)
        {
        this.vStrand       = vStrand;
        this.iControlFirst = iControlFirst;
        this.iControlLast  = iControlLast;
        this.text          = text;
        //
        Debug.Assert(iControlFirst < iControlLast);
        //
        this.SetStyleName(style);  // default
        component.AddRenderable(this);
        }
コード例 #34
0
ファイル: Rendering.cs プロジェクト: rgatkinson/nadir
    void WireHydrogenBonds(GraphComponent component, IEnumerable<Strand> strands)
    // Connect up any hydrogen bonds involving this set of strands that haven't already been visualized
        {
        HashSet<DoubleStrandedRegion> allDsRegions = new HashSet<DoubleStrandedRegion>();

        foreach (Strand strand in strands)
            {
            HashSet<DoubleStrandedRegion> dsRegions = strand.DoubleStrandedRegions();
            foreach (DoubleStrandedRegion region in dsRegions)
                {
                if (!allDsRegions.Contains(region))
                    {
                    allDsRegions.Add(region);

                    Domain dFirst = region.dFirst;
                    Domain dLast  = region.dLast;

                    VisualStrand vStrandTop    = this.mpStrandVisualization[dFirst.Strand];
                    VisualStrand vStrandBottom = this.mpStrandVisualization[dFirst.Connection.Strand];
                    //
                    new VisualDoubleStrandedRegion(component, 
                        vStrandTop,    dFirst.StrandIndex,           dLast.StrandIndex+1,
                        vStrandBottom, dLast.Connection.StrandIndex, dFirst.Connection.StrandIndex+1,
                        region.Length);
                    }
                }
            }

        foreach (Strand strand in strands)
            {
            foreach (Domain d in strand.AllDomains())
                {
                if (d.IsConnected)
                    {
                    GraphEdge edgeFrom = EdgeFromDomain(component, d,            true);
                    GraphEdge edgeTo   = EdgeFromDomain(component, d.Connection, true);
                    //
                    this.WireHydrogenBond(component, d, edgeFrom.A, edgeTo.B,   edgeFrom.B, edgeTo.A);
                    this.WireHydrogenBond(component, d, edgeTo.A,   edgeFrom.B, edgeTo.B,   edgeFrom.A);
                    }
                }
            }

        }
コード例 #35
0
ファイル: Rendering-Drawing.cs プロジェクト: rgatkinson/nadir
    //----------------------------------------------------------------------------------------
    // Construction
    //----------------------------------------------------------------------------------------

    public VisualGraphVertex(GraphComponent component, PointD location) : base(component)
        {
        this.Location = location;
        component.AddRenderable(this);
        component.Locatables.Add(this);
        this.SetStyleName(Constants.StyleDot);  // default
        this.IsSelectable = true;
        }
コード例 #36
0
    public GraphComponentController createComponent(GraphComponent comp)
    {
        //creates the component

        //find the x and y of the component
        Vector2Int pos          = comp.Position;
        Vector2Int size         = comp.Size;
        Vector3    basePosition = new Vector3(pos.x, pos.y, 0);
        Vector3    offset       = new Vector3(size.x / 2f, size.y / 2f, 0);

        if (comp.Rotation % 2 == 1)
        {
            float newX = offset.y;
            offset.y = offset.x;
            offset.x = newX;
        }

        //rotates the component
        Vector2 position = this.bottomLeftofGraph + basePosition + offset;

        Vector3 componentRotation = new Vector3(0, 0, -90 * comp.Rotation);

        if (comp.Flipped)
        {
            componentRotation = new Vector3(0, 180, 90 * comp.Rotation);
        }

        Type       resultType = null;
        GameObject prefab     = null;

        //logic compoents
        if (comp.GetType().BaseType == typeof(LogicComponent))
        {
            prefab     = (GameObject)SceneResouces.SceneObjects["Default"][typeof(GameObject)]["BasicLogicComponent"];
            resultType = typeof(LogicComponentController);

            //passive components
        }
        else if (comp.GetType().BaseType == typeof(PassiveComponent))
        {
            prefab     = (GameObject)SceneResouces.SceneObjects["Default"][typeof(GameObject)]["PassingMirror"];
            resultType = typeof(PassiveComponentController);
        }
        else if (comp.GetType().BaseType == typeof(LinkComponent))
        {
            prefab     = (GameObject)SceneResouces.SceneObjects["Default"][typeof(GameObject)]["BasicLogicComponent"];
            resultType = typeof(BridgeComponentController);
        }
        else
        {
            throw new System.Exception("This Component is not supported while making the GameObject");
        }

        GameObject go = Instantiate(prefab);
        GraphComponentController gcc = (GraphComponentController)go.AddComponent(Type.GetType(resultType.ToString()));

        go.transform.SetParent(this.transform, true);
        go.transform.position    = position;
        go.transform.eulerAngles = componentRotation;
        gcc.setUp(comp);

        return(gcc);
    }
コード例 #37
0
ファイル: Rendering-Drawing.cs プロジェクト: rgatkinson/nadir
 public VisualDomainEndTick(GraphComponent component, VisualStrand strand, int iControlPoint, double length) : base(component)
     {
     this.strand        = strand;
     this.iControlPoint = iControlPoint;
     this.length        = length;
     this.SetStyleName(Constants.StyleDomainEnd);
     component.AddRenderable(this);
     }
コード例 #38
0
        private void DrawGraph()
        {
            var rect = GUILayoutUtility.GetRect(Mathf.Max(50.0f, Screen.width - 100.0f), 200.0f);

            if (Event.current.type != EventType.Repaint)
            {
                return;
            }

            GraphComponent graphComponent = target as GraphComponent;

            UnityEditor.Graphs.Styles.graphBackground.Draw(rect, false, false, false, false);

            LineMaterial.Material.SetPass(0);

            GL.PushMatrix();
            GL.Begin(GL.LINES);

            float left   = rect.position.x;
            float right  = rect.position.x + rect.width;
            float middle = rect.position.y + rect.height * 0.5f;

            GL.Color(LineColor.AxisColor);
            DrawLine(new Vector2(left, middle), new Vector2(right, middle));

            foreach (var kvp in graphComponent.Buffers)
            {
                var buff = kvp.Value;

                if (graphComponent.Colors.ContainsKey(kvp.Key))
                {
                    GL.Color(graphComponent.Colors[kvp.Key]);
                }
                else
                {
                    GL.Color(LineColor.DefaultLineColor);
                }

                for (int i = 0; i < buff.Count - 1; ++i)
                {
                    float x0 = right - (buff.Count - i);
                    float x1 = x0 + 1.0f;

                    if (x0 < rect.position.x)
                    {
                        continue;
                    }

                    float y0 = -buff[i] * graphComponent.Scale + middle;
                    float y1 = -buff[i + 1] * graphComponent.Scale + middle;

                    y0 = Mathf.Max(Mathf.Min(y0, rect.position.y + rect.height), rect.position.y);
                    y1 = Mathf.Max(Mathf.Min(y1, rect.position.y + rect.height), rect.position.y);

                    DrawLine(new Vector2(x0, y0), new Vector2(x1, y1));
                }
            }

            GL.End();
            GL.PopMatrix();

            Repaint();
        }
コード例 #39
0
ファイル: Rendering-Drawing.cs プロジェクト: rgatkinson/nadir
    //-----------------------------------------------------------------------------
    // Construction
    //-----------------------------------------------------------------------------

    protected VisualizationBase(GraphComponent component)
        {
        this.component = component;
        }
コード例 #40
0
    public override void spawnContents(WindowController windowController, Transform contentPanel, Canvas canvas)
    {
        CameraManager cameraManager = GameObject.Find("CameraManager").GetComponent <CameraManager>();
        Camera        cam           = cameraManager.makeNewCamera(false);

        this.camera = cam;

        Vector2 graphPosition = this.camera.transform.position;

        this.logicGraphController = this.logicGraphManager.displayLogicGraph(this.graph, graphPosition);

        GameObject image = GameObject.Instantiate((GameObject)SceneResouces.SceneObjects["Default"][typeof(GameObject)]["GraphEditor"]);

        this.rawImage = image.GetComponent <RawImage>();
        image.transform.SetParent(contentPanel.transform, false);
        this.rawImageRect = image.GetComponent <RectTransform>();

        //only for testing
        this.mouseObject = new GameObject("Mouse Graph Position");
        this.mouseObject.transform.position = new Vector3(this.camera.transform.position.x, this.camera.transform.position.y, 0);

        this.renderTexture    = new RenderTexture(512, 512, 16);
        this.rawImage.texture = this.renderTexture;

        this.camera.targetTexture = this.renderTexture;
        this.renderTexture.Create();

        LogicGraphCameraController lgcc = this.camera.gameObject.AddComponent <LogicGraphCameraController>();

        lgcc.setUp(graphPosition, this.logicGraphController.Graph, this.inputs, this.rawImage);

        #region GUIButtons

        Transform basePanel = image.transform.Find("Panel");

        Button andButton           = basePanel.Find("AndButton").GetComponent <Button>();
        Button orButton            = basePanel.Find("OrButton").GetComponent <Button>();
        Button notButton           = basePanel.Find("NotButton").GetComponent <Button>();
        Button bufferButton        = basePanel.Find("BufferButton").GetComponent <Button>();
        Button nandButton          = basePanel.Find("NandButton").GetComponent <Button>();
        Button norButton           = basePanel.Find("NorButton").GetComponent <Button>();
        Button xorButton           = basePanel.Find("XorButton").GetComponent <Button>();
        Button xnorButton          = basePanel.Find("XnorButton").GetComponent <Button>();
        Button reflector           = basePanel.Find("ReflectorButton").GetComponent <Button>();
        Button splitterButton      = basePanel.Find("SplitterButton").GetComponent <Button>();
        Button sendBridgeButton    = basePanel.Find("SendBridgeButton").GetComponent <Button>();
        Button receiveBridgeButton = basePanel.Find("ReceiveBridgeButton").GetComponent <Button>();
        Button deleteButton        = basePanel.Find("DeleteButton").GetComponent <Button>();

        //adds the component to the button
        andButton.onClick.AddListener(() => {
            this.component = new AndGate(this.previousGridPosition, this.rotation, this.flipped);
            this.changeComponent();
        });
        orButton.onClick.AddListener(() => {
            this.component = new OrGate(this.previousGridPosition, this.rotation, this.flipped);
            this.changeComponent();
        });
        notButton.onClick.AddListener(() => {
            this.component = new NotGate(this.previousGridPosition, this.rotation, this.flipped);
            this.changeComponent();
        });
        bufferButton.onClick.AddListener(() => {
            this.component = new BufferGate(this.previousGridPosition, this.rotation, this.flipped);
            this.changeComponent();
        });
        norButton.onClick.AddListener(() => {
            this.component = new NorGate(this.previousGridPosition, this.rotation, this.flipped);
            this.changeComponent();
        });
        xorButton.onClick.AddListener(() => {
            this.component = new XorGate(this.previousGridPosition, this.rotation, this.flipped);
            this.changeComponent();
        });
        xnorButton.onClick.AddListener(() => {
            this.component = new XnorGate(this.previousGridPosition, this.rotation, this.flipped);
            this.changeComponent();
        });
        nandButton.onClick.AddListener(() => {
            this.component = new NandGate(this.previousGridPosition, this.rotation, this.flipped);
            this.changeComponent();
        });
        splitterButton.onClick.AddListener(() => {
            this.component = new Splitter(this.previousGridPosition, this.rotation, this.flipped);
            this.changeComponent();
        });
        reflector.onClick.AddListener(() => {
            this.component = new Reflector(this.previousGridPosition, this.rotation, this.flipped);
            this.changeComponent();
        });
        sendBridgeButton.onClick.AddListener(() => {
            this.component = new GraphOutput(this.previousGridPosition, this.rotation, this.flipped, new ExtensionNode("Blank", ExtensionNode.ExtensionState.SEND));
            this.changeComponent();
        });
        receiveBridgeButton.onClick.AddListener(() => {
            this.component = new GraphInput(this.previousGridPosition, this.rotation, this.flipped, new ExtensionNode("Blank", ExtensionNode.ExtensionState.RECEIVE));
            this.changeComponent();
        });

        deleteButton.onClick.AddListener(() => {
            this.currentState = EditorState.DeleteComponent;
            this.destroyMouseChildren();
            GameObject xSprite = this.makeX().gameObject;
            xSprite.transform.SetParent(this.mouseObject.transform);
            xSprite.transform.localPosition = new Vector2(.5f, .5f);
        });

        //selects the first button
        andButton.onClick.Invoke();
        andButton.Select();

        #endregion

        #region KeyboardInputs
        //rotations
        this.inputs.addInput(new KeyCombination(KeyCode.Q, KeyStatus.Down), () => {
            this.rotation = (rotation + 1) % 4;
            this.changeComponent();
        });
        this.inputs.addInput(new KeyCombination(KeyCode.E, KeyStatus.Down), () => {
            this.rotation = this.rotation - 1;
            if (this.rotation < 0)
            {
                rotation = 3;
            }
            this.changeComponent();
        });

        //flip
        this.inputs.addInput(new KeyCombination(KeyCode.F, KeyStatus.Down), () => {
            this.flipped = !flipped;
            this.changeComponent();
        });

        //mouse rest
        this.inputs.addInput(new KeyCombination(KeyCode.Mouse0, KeyStatus.Rest), () => {
            if (this.logicGraphController.BottomLeftWorld != this.previousGridPosition)
            {
                Vector2Int currentMousePos = this.getMouseLocalGridPosition();

                if (!this.previousGridPosition.Equals(currentMousePos))
                {
                    this.previousGridPosition = currentMousePos;

                    if (this.currentState == EditorState.AddCompoent)
                    {
                        this.component.Position = this.previousGridPosition;
                        bool canPlace           = this.logicGraphController.Graph.LightGraph.canPlace(this.component);

                        this.mouseObject.transform.Find("X").gameObject.SetActive(!canPlace);
                        Vector2 worldMousePosition          = this.getMouseWorldGridPosition();
                        this.mouseObject.transform.position = worldMousePosition;
                    }
                    else if (this.currentState == EditorState.DeleteComponent)
                    {
                        Vector2 worldMousePosition          = this.getMouseWorldGridPosition();
                        this.mouseObject.transform.position = worldMousePosition;

                        GraphComponent graphComp = this.logicGraphController.Graph.LightGraph.getComponentAt(
                            this.previousGridPosition.x, this.previousGridPosition.y);

                        SpriteRenderer rend = this.mouseObject.transform.GetChild(0).GetComponent <SpriteRenderer>();

                        if (graphComp != null)
                        {
                            rend.color = Color.red;
                        }
                        else
                        {
                            rend.color = Color.gray;
                        }
                    }
                }
            }
        });

        //mouse down
        this.inputs.addInput(new KeyCombination(KeyCode.Mouse0, KeyStatus.Down), () => {
            if (this.currentState == EditorState.AddCompoent)
            {
                //adds the component
                LightComponent comp = this.duplicateAt(this.component.GetType(), this.previousGridPosition, this.rotation, this.flipped);

                if (this.logicGraphController.Graph.LightGraph.canPlace(comp) &&
                    this.inputs.CurrentFrameData.RaycastResults.Count != 0 &&
                    this.inputs.CurrentFrameData.RaycastResults[0].gameObject.Equals(this.rawImage.gameObject))
                {
                    if (comp.GetType().IsSubclassOf(typeof(LinkComponent)))
                    {
                        EnterTextContent etc = new EnterTextContent(
                            "Type in a unique name for the Bridge." +
                            " The name can not be the same as another bridge on this Graph",
                            (string inputFieldText) => {
                            //confrim
                            ((LinkComponent)comp).getExtensionConnection().Name = inputFieldText;
                            addComponentToGraph(comp);
                        },
                            () => {},
                            15);

                        //names exits
                        etc.addErrorCheck((string value) => {
                            bool result = true;
                            int counter = 0;

                            ExtensionNode[] checkBridges = this.logicGraphController.Graph.AllBridges();

                            while (result && counter < checkBridges.Length)
                            {
                                if (value.Equals(checkBridges[counter].Name))
                                {
                                    result = false;
                                }

                                counter++;
                            }

                            return(result);
                        }, "Name Already Exits");

                        //can place component after entering value
                        etc.addErrorCheck((string value) => {
                            return(this.logicGraphController.Graph.LightGraph.canPlace(comp));
                        }, "Can not Place there");

                        this.spawnChildWindow(new Window(comp.GetType() + " Name", 200, 200, etc));
                    }
                    else
                    {
                        this.addComponentToGraph(comp);
                    }
                }
            }
            else if (currentState == EditorState.DeleteComponent)
            {
                //removes the component

                Vector2Int gridPosition     = this.getMouseLocalGridPosition();
                LightComponent hitComponent = this.graph.LightGraph.getComponentAt(gridPosition.x, gridPosition.y);

                if (hitComponent != null)
                {
                    bool removedGOState  = this.logicGraphController.ComponentManager.removeComponent(hitComponent);
                    bool removeDataState = this.graph.LightGraph.removeComponent(hitComponent);

                    if (removedGOState && removeDataState)
                    {
                        this.logicGraphController.ComponentManager.reconnectRays();
                    }
                    else
                    {
                        throw new System.Exception("ComponentNotFound: GameObjectRemoval:" + removedGOState + " DataRemoval" + removeDataState);
                    }
                }
            }
        });

        #endregion
    }
コード例 #41
0
ファイル: Rendering-Drawing.cs プロジェクト: rgatkinson/nadir
    //----------------------------------------------------------------------------------------
    // Construction
    //----------------------------------------------------------------------------------------

    public VisualStrand(Strand strand, GraphComponent component, List<GraphEdge> strandEdges, List<GraphVertex> strandVertices) : base(component)
        {
        this.Strand         = strand;
        this.strandEdges    = strandEdges;
        this.strandVertices = strandVertices;
        this.Vertices       = new List<VisualGraphVertex>(strandVertices.Select((v) => v.Visualization));
        component.AddRenderable(this);
        this.SetStyleName(Constants.StyleSpline);  // default
        this.IsSelectable = true;
        }