Esempio n. 1
0
        public void accessData(JSONObject obj)
        {
            floors = obj.list[0];                           //this is the root for the floors JSON object
            nodes = obj.list[1];                            //this is the root for the nodes JSON object
            edges = obj.list[2];                            //this is the root for the edges JSON object
            storylines = obj.list[3];                       //this is the root for the storylines JSON object

            floorList = populateFloors();                   //parse the floors
            edgeList = PopulateEdges();                     //parse the edges
            storylineList = PopulateStorylines();           //parse the storylines
            nodeList = populateNodes();                     //parse the nodes

            initializePoiAndStorypointLists();      //populate the list that contains the points of interest and the other that contains storypoints

            createStartAndEndNode(); //transform the id's of the nodes in the edges into Node objects

            setAdjacencies();              //add all the adjacencies to all the nodes

            map = new Map();
            //map.setPoiList(poiList);
            //map.setStorypointList(storypointList);
            map.setFloorplanList(floorList);
            map.setStorylineList(storylineList);
            map.initializeGraph(poiList);
        }
Esempio n. 2
0
        public void initializeGraphTest()
        {
            try
            {
                Map map = new Map();
                Node n1 = new PointOfInterest(1, 0, 0, 1);
                Node n2 = new PointOfInterest(2, 0, 0, 1);

                List<Node> nodeList = new List<Node>();

                nodeList.Add(n1);
                nodeList.Add(n2);

                map.setPoiList(nodeList);

                Graph g = new Graph();
                g.InsertNewVertex(n1);
                g.InsertNewVertex(n2);

                map.initializeGraph(nodeList);
                Graph mapGraph = map.getGraph();

                Assert.IsNotNull(nodeList);
                Assert.IsNotNull(g);
                Assert.IsNotNull(mapGraph);

                Assert.Equals(g, mapGraph);
            }
            catch (SecurityException e)
            {
                Console.WriteLine("Security Exception:\n\n{0}", e.Message);
            }
        }