Exemplo n.º 1
0
        public WalkRoutePage(DiwiPageBase parent)
            : base(parent)
        {
            mMenu.addItem("Voeg Text toe", new DiwiUIMenu.DiwiMenuCallbackHandler(doText), AppController.sTextIcon);
            mMenu.addItem("Voeg Foto toe", new DiwiUIMenu.DiwiMenuCallbackHandler(doFoto), AppController.sFotoIcon);
            mMenu.addItem("Voeg Video toe", new DiwiUIMenu.DiwiMenuCallbackHandler(doVideo), AppController.sVideoIcon);
            mMenu.addItem("Stop Route", new DiwiUIMenu.DiwiMenuCallbackHandler(doStopRoute), AppController.sStopRIcon);
            mMenu.addItem("Toon Volksmond", new DiwiUIMenu.DiwiMenuCallbackHandler(doUGC), AppController.sUGCIcon);
            mMenu.addItem("Terug", new DiwiUIMenu.DiwiMenuCallbackHandler(doTerug), AppController.sTerugIcon);

            poiCB = new POIHandler(navPointReceive);

            AppController.sKwxClient.poiCallback += new KwxClient.POICallback(navPointMessage);
            MapHandler.sDownloadCallback         += new MapHandler.CallbackHandler(mapReceivedCB);

            mZoomIn  = new DiwiUIButton(offScreenGraphics, 146, 170, "Zoom+", buttonZoomIn, this);
            mZoomOut = new DiwiUIButton(offScreenGraphics, 146, 170, "Zoom-", buttonZoomOut, this);

            addDrawable(mZoomIn);
            addDrawable(mZoomOut);

            gpsText = new DiwiUIText(Color.Black, "Geen GPS", new Font("Arial", 12, FontStyle.Bold));
            AppController.sGpsReader.callback += new GpsReader.CallbackHandler(gpsMessage);

            addDrawable(gpsText);

            reOrient();

            mIsMapPage = true;
        }
    //delete all existing scene buttons and markers and generate from the xml file
    private void GenerateButsMarkers(POIHandler handler)
    {
        ClearButsMarkers();

        //generate new buttons from the xml file
        foreach (POI point in handler.projectPOIs)
        {
            GenerateButMarkerPair(point);
            POIList.localPosition = Vector3.zero;
        }
    }
 //load the xml from specified path into the handler
 public void loadButsFromXML(string XMLpath, ref POIHandler handler)
 {
     if (File.Exists(XMLpath))
     {
         //load the POIHandler.xml, the saved button files
         handler = XmlIO.Load(XMLpath, typeof(POIHandler)) as POIHandler;
     }
     else
     {
         Debug.Log("saved buttons not found! need to generate saved button files based on current project.");
     }
 }
    //save the buttons in the scene into the XML file and the orginalHandler
    public void SaveButsToXML()
    {
        Debug.Log("generating saved button files based on current project");
        originalHandler = new POIHandler();
        foreach (Transform child in POIList.transform)
        {
            POI pointToAdd = child.GetComponent <POIInfoRef>().poiInfo.Point;
            originalHandler.AddPoint(pointToAdd);
        }

        XmlIO.Save(originalHandler, POI_GlobalVariables.XMLpath);
    }
    //delete all existing scene buttons and markers and generate from the xml file
    private void GenerateButsMarkers(POIHandler handler)
    {
        ClearButsMarkers();

        //generate new buttons
        foreach (POI point in handler.projectPOIs)
        {
            GenerateButMarkerPair(point);
            POIList.sizeDelta     = new Vector2(POIList.sizeDelta.x, POIlistHeight);
            POIList.localPosition = Vector3.zero;
        }
    }
    //this is the combination of function loadButsFromXML and GenerateButsMarkers
    public void LoadAndGenerateButs()
    {
        if (File.Exists(POI_GlobalVariables.XMLpath))
        {
            ClearButsMarkers();

            //load the POIHandler.xml, the saved button files
            originalHandler = XmlIO.Load(POI_GlobalVariables.XMLpath, typeof(POIHandler)) as POIHandler;

            //generate new buttons
            foreach (POI point in originalHandler.projectPOIs)
            {
                GenerateButMarkerPair(point);
                POIList.localPosition = Vector3.zero;
            }
        }
        else
        {
            Debug.Log("saved buttons not found! need to generate saved button files based on current project.");
        }
    }