public override void GetDisplayList(DisplayItemList DLList
            , Matrix44 trans)
        {
            Debug.Assert(DLList != null && trans != null);
            if (null == DLList || null == trans) return;

            GePoint Base = new GePoint(0, 0, 0);
            GePoint End = new GePoint(m_Width, 0, 0);
            GePoint Top = new GePoint(m_Width, m_Height / 2, 0);
            GePoint Bottom = new GePoint(m_Width, -m_Height / 2, 0);
            Base.Transform(trans);
            End.Transform(trans);
            Top.Transform(trans);
            Bottom.Transform(trans);

            FRList<GePoint> PointList = new FRList<GePoint>();
            PointList.Add(Base);
            PointList.Add(Top);
            PointList.Add(Bottom);
            PointList.Add(Base);

            DisplayItemBuilder.GenDisplayItemLines(DLList, PointList);
            DisplayItemBuilder.GenDisplayItemPoint(DLList, Base);
            DisplayItemBuilder.GenDisplayItemPoint(DLList, End);
        }
Example #2
0
        public PtView(OpenGLSheet PicBox)
        {
            m_PictureBox = PicBox;

            // Add observers.
            m_ViewObserverList = new FRList<ViewPaintObserver>();
            m_ViewObserverList.Add(new NotesObserver());
            m_ViewObserverList.Add(new SelectionObserver());
            m_ViewObserverList.Add(new PreviewObserver());
            m_TransientObjObserver = new TransientObjectObserver();
            m_ViewObserverList.Add(m_TransientObjObserver);

            // Initialize the transform matrix.
            m_DeviceToWorld = Matrix44.Identity;
            m_DeviceToWorld.SetTranslation(GePoint.kOrigin - new GePoint(10, 10));

            // Hook up the events.
            m_PictureBox.MouseDown += new MouseEventHandler(OnMouseDown);
            m_PictureBox.MouseUp += new MouseEventHandler(OnMouseUp);
            m_PictureBox.MouseMove += new MouseEventHandler(OnMouseMove);
            m_PictureBox.MouseDoubleClick += new MouseEventHandler(OnMouseDoubleClick);
            m_PictureBox.MouseClick += new MouseEventHandler(OnMouseClick);
            m_PictureBox.MouseWheel += new MouseEventHandler(OnMouseWheel);

            m_PictureBox.DrawingRender += new System.Windows.Forms.PaintEventHandler(DrawingRender);
            m_PictureBox.DeviceType = OpenGLSheet.GraphicDeviceType.OPENGL;

            m_SelectionManager = new SelectionManager();
        }
        public override void GetDisplayList(DisplayItemList DLList
            , Matrix44 trans)
        {
            Debug.Assert(DLList != null && trans != null);
            if (null == DLList || null == trans) return;

            GePoint Base = new GePoint(0, 0, 0);
            GePoint End = new GePoint(m_Width, 0, 0);
            GePoint Top = new GePoint(m_Width, m_Height / 2, 0);
            GePoint Bottom = new GePoint(m_Width, -m_Height / 2, 0);
            Base.Transform(trans);
            End.Transform(trans);
            Top.Transform(trans);
            Bottom.Transform(trans);

            FRList<GePoint> PointList = new FRList<GePoint>();
            PointList.Add(Base);
            PointList.Add(Top);
            PointList.Add(Bottom);
            PointList.Add(Base);

            FRList<GePoint> meshPoints = new FRList<GePoint>();
            meshPoints.Add(Base);
            meshPoints.Add(End);
            meshPoints.Add(Top);
            meshPoints.Add(Bottom);

            // Use two triangles
            FRList<int> connectivity = new FRList<int>();
            connectivity.Add(0);
            connectivity.Add(1);
            connectivity.Add(2);

            connectivity.Add(0);
            connectivity.Add(1);
            connectivity.Add(3);

            DisplayItemBuilder.GenDisplayItemLines(DLList, PointList);
            DisplayItemBuilder.GenDisplayItemMesh(DLList
                , connectivity, meshPoints, null, null);
            DisplayItemBuilder.GenDisplayItemPoint(DLList, Base);
            DisplayItemBuilder.GenDisplayItemPoint(DLList, End);
        }
        public virtual void DrawMesh(FRList<int> connectivity
            , FRList<GePoint> points, FRList<UnitVector> normals
            , FRList<Color> colors)
        {
            // We should keep the sequence of the points.
            FRList<GePoint> worldPoints = new FRList<GePoint>();
            foreach (GePoint point in points)
            {
                worldPoints.Add(GetDevicePoint(point));
            }

            m_Device.DrawMesh(connectivity, worldPoints
                , normals, colors);
        }
Example #5
0
        public DimensionParser()
        {
            m_UnitStringList = new FRList<string>();
            for (int i = 0; i < (int)DimensionUnit.eUnitCount; i++)
                m_UnitStringList.Add("");

            // These strings need globalization/ localization
            m_UnitStringList[(int)DimensionUnit.eMM] = "mm";
            m_UnitStringList[(int)DimensionUnit.eCM] = "cm";
            m_UnitStringList[(int)DimensionUnit.eM] = "m";
            m_UnitStringList[(int)DimensionUnit.eInch] = "in";
            // End

            m_Period = '.';
            m_Unit = DimensionUnit.eMM;
        }
Example #6
0
        // The old oldPoints can't be null, the trans can be null.
        public static FRList<GePoint> GetTransformedPoints(FRList<GePoint> oldPoints, Matrix44 trans)
        {
            Debug.Assert(oldPoints != null);
            FRList<GePoint> newPoints = null;
            if (oldPoints != null && trans != null)
            {
                newPoints = new FRList<GePoint>();
                for (int i = 0; i < oldPoints.Count; i++)
                {
                    newPoints.Add(trans * oldPoints[i]);
                }
            }
            else // either of them is null.
                newPoints = oldPoints;

            return newPoints;
        }
        private FRList<String> GetCandidateAssemblies()
        {
            FRList<String> ComponentAssembies = new FRList<string>();
            String AppPath = System.Environment.CurrentDirectory;

            String[] filelist = System.IO.Directory.GetFiles(AppPath);
            foreach (String file in filelist)
            {
                // We only get the dll files as the candidate assemblies.
                if (file.EndsWith(".dll"))
                    ComponentAssembies.Add(file);
            }

            return ComponentAssembies;
        }
Example #8
0
 public override void GetPredecessor(FRList<Node> nodeList)
 {
     nodeList.Add(m_DepCenterPoint);
     base.GetPredecessor(nodeList);
 }
Example #9
0
        public bool TopologySort()
        {
            m_TopologySortedNodeList.Clear();

            FRList<GraphVertex> ZeroPredecessorVertexList = new FRList<GraphVertex>();
            while (true)
            {
                ZeroPredecessorVertexList.Clear();
                foreach (GraphVertex curVertex in m_NodeGraphVertexMap.Values)
                {
                    if (curVertex.Valid() && curVertex.GetpredecessorCount() == 0)
                        ZeroPredecessorVertexList.Add(curVertex);
                }

                // There is no zero degree vertex.
                // 1. Finish all the vertex.
                // 2. The left vertex are circles.
                if (ZeroPredecessorVertexList.Count == 0)
                    break;

                foreach (GraphVertex vertex in ZeroPredecessorVertexList)
                {
                    m_TopologySortedNodeList.Add(vertex.GetNode());

                    // In valid the vertex and edges.
                    vertex.SetValid(false);
                    foreach (GraphEdge edge in vertex.GetSuccessorEdges())
                    {
                        edge.SetValid(false);
                    }
                }
            }

            // If the sorted vertexes count isn't equal to the graph vertex count, that means there exist circle.
            Debug.Assert(m_TopologySortedNodeList.Count == m_NodeGraphVertexMap.Count);
            if (m_TopologySortedNodeList.Count != m_NodeGraphVertexMap.Count)
                return false;

            return true;
        }
Example #10
0
        public void InvalidatePredecessors(Node node)
        {
            GraphVertex thisVertex = null;
            if(m_NodeGraphVertexMap.ContainsKey(node))
                thisVertex = m_NodeGraphVertexMap[node];
            if (thisVertex == null)
                return;

            FRList<GraphVertex> ZeroPredecessorVertexList = new FRList<GraphVertex>();

            while (true)
            {
                ZeroPredecessorVertexList.Clear();
                foreach (GraphVertex curVertex in m_NodeGraphVertexMap.Values)
                {
                    // Don't invalidate the input node vertex
                    if (curVertex.Valid() && curVertex != thisVertex &&
                        curVertex.GetpredecessorCount() == 0)
                        ZeroPredecessorVertexList.Add(curVertex);
                }

                // There is no zero degree vertex.
                if (ZeroPredecessorVertexList.Count == 0)
                    break;

                foreach (GraphVertex vertex in ZeroPredecessorVertexList)
                {
                    m_TopologySortedNodeList.Add(vertex.GetNode());

                    // In valid the vertex and edges.
                    vertex.SetValid(false);
                    foreach (GraphEdge edge in vertex.GetSuccessorEdges())
                    {
                        edge.SetValid(false);
                    }
                }
            }
        }
Example #11
0
        public void GetImmediateSuccessors(Node node, FRList<Node> immediateSucs)
        {
            GraphVertex vertex = null;
            if (!m_NodeGraphVertexMap.ContainsKey(node))
                return;

            vertex = m_NodeGraphVertexMap[node];

            foreach (GraphEdge edge in vertex.GetSuccessorEdges())
            {
                Node sucNode = edge.GetEndVertex().GetNode();
                Debug.Assert(sucNode != node);

                if (!immediateSucs.Contains(sucNode))
                    immediateSucs.Add(sucNode);
            }
        }
Example #12
0
        public void GetImmediatePredecessors(Node node, FRList<Node> immediatePres)
        {
            GraphVertex vertex = null;
            if (!m_NodeGraphVertexMap.ContainsKey(node))
                return;

            vertex = m_NodeGraphVertexMap[node];

            foreach(GraphEdge edge in vertex.GetPredecessorEdges())
            {
                Node preNode = edge.GetStartVertex().GetNode();
                Debug.Assert(preNode != node);

                if (!immediatePres.Contains(preNode))
                    immediatePres.Add(preNode);
            }
        }
Example #13
0
 public override void GetSuccessor(FRList<Node> nodeList)
 {
     nodeList.Add(m_SymbolState);
     base.GetSuccessor(nodeList);
 }
 public override void GetPredecessor(FRList<Node> nodeList)
 {
     if (m_Instance != null)
         nodeList.Add(m_Instance);
     base.GetPredecessor(nodeList);
 }
 public override void GetSuccessor(FRList<Node> nodeList)
 {
     if(m_PointState != null)
         nodeList.Add(m_PointState);
     base.GetSuccessor(nodeList);
 }
Example #16
0
        // bClearRelatedNodes indicates whether remove the related nodes
        // or just remove the input one.
        public void RemoveNode(Node node, bool bClearRelatedNodes)
        {
            if (!IsExist(node))
                return;

            if(!bClearRelatedNodes)
            {
                m_NodeList.Remove(node);
            }
            else
            {
                FRList<Node> deletedNodeList = new FRList<Node>();
                FRList<Node> dieNominateList = new FRList<Node>();

                deletedNodeList.Add(node);
                dieNominateList.Add(node);

                while (dieNominateList.Count > 0)
                {
                    Node tmpNode = dieNominateList[0];
                    dieNominateList.Remove(tmpNode);

                    if (deletedNodeList.Contains(tmpNode) || tmpNode.IsDeletable(deletedNodeList))
                    {
                        if (!deletedNodeList.Contains(tmpNode))
                            deletedNodeList.Add(tmpNode);

                        FRList<Node> nodeNominates = new FRList<Node>();
                        tmpNode.GetDeleteNominates(nodeNominates);

                        foreach (Node item in nodeNominates)
                        {
                            if (!dieNominateList.Contains(item))
                                dieNominateList.Add(item);
                        }
                    }
                }

                // Delete the nodes in the data model
                foreach (Node delNode in deletedNodeList)
                   m_NodeList.Remove(delNode);
            }

            m_bIsGraphDirty = true;
        }