Exemplo n.º 1
0
 public void remove(Poi target)
 {
     Debug.WriteLine("remove: " + target, this.ToString());
     lock (targets)
     {
         targets.Remove(target);
         targetsAreas.Remove(target);
     }
 }
Exemplo n.º 2
0
 public void add(Poi target)
 {
     Debug.WriteLine("add: " + target, this.ToString());
     lock (targets)
     {
         targets.Add(target);
         Area tArea = createTargetArea(target);
         targetsAreas[target] = tArea;
     }
 }
Exemplo n.º 3
0
        public Point getPoiPixelCoordinates(Poi p)
        {
            double deltaLongitude = p.getLongitude() - this.area.getTopLeftLongitude();
            double deltaLatitude  = this.area.getTopLeftLatitude() - p.getLatitude();

            int x = (int)Math.Floor(deltaLongitude / this.longitudePerPixel);
            int y = (int)Math.Floor(deltaLatitude / this.latitudePerPixel);

            return(new Point(x, y));
        }
Exemplo n.º 4
0
 public void move(Poi target, int move)
 {
     Debug.WriteLine("move: " + target + ", move: " + move, this.ToString());
     lock (targets)
     {
         int index = targets.IndexOf(target);
         int moveIndex = index + move;
         Poi tmp = targets[moveIndex];
         targets[moveIndex] = target;
         targets[index] = tmp;
     }
 }
Exemplo n.º 5
0
 public void downloadPoiMedia(Poi p)
 {
     foreach (MediaFile m in p.getAllMediaFiles())
     {
         Debug.WriteLine("downloading media file: uri: " + m.getUrl().ToString(), ToString());
         try
         {
             byte[] mediaData = this.portal.download(m.getUrl());
             m.setMedia(mediaData);
         }
         catch (PortalException e)
         {
             Debug.WriteLine("loadPoiMedia: portal error: " + e.Message, ToString());
         }
     }
 }
Exemplo n.º 6
0
 /**
  * Loads Poi basic data: descr, lang and type from xml file
  */
 public void loadData(Poi poi, string poiSubDir)
 {
     //Debug.WriteLine("loadData: poi sub dir: " + poiSubDir, ToString());
     string descr = "";
     string lang = "";
     string type = "";
     // load xml document
     XmlDocument poiXmlDoc = new XmlDocument();
     string poiXmlPath = getPoiXmlPath(poiSubDir);
     poiXmlDoc.Load(poiXmlPath);
     // get descr
     XmlNode descrNode = poiXmlDoc.SelectSingleNode("/poi/descr");
     descr = descrNode.InnerText;
     // get lang
     XmlNode langNode = poiXmlDoc.SelectSingleNode("/poi/lang");
     lang = langNode.InnerText;
     // get type
     XmlNode typeNode = poiXmlDoc.SelectSingleNode("/poi/type");
     type = typeNode.InnerText;
     // insert data into poi
     poi.insertData(descr, lang, type);
 }
Exemplo n.º 7
0
        public override object parse(XmlNode objNode)
        {
            // get required poi's parameters
            string name = objNode.SelectSingleNode("name").InnerText.Trim();
            double latitude = Convert.ToDouble(objNode.SelectSingleNode("latitude").InnerText.Trim());
            double longitude = Convert.ToDouble(objNode.SelectSingleNode("longitude").InnerText.Trim());
            string lang = objNode.SelectSingleNode("lang").InnerText.Trim();
            string type = objNode.SelectSingleNode("type").InnerText.Trim();
            string descr = objNode.SelectSingleNode("descr").InnerText.Trim();
            // instantiate poi
            Poi poi = new Poi(name, latitude, longitude, lang, type, descr);
            // parse media files

            MediaFilesXmlAdapter mediaFilesParser = new MediaFilesXmlAdapter(poi.getMediaFiles());
            XmlNode mediaFilesNode = objNode.SelectSingleNode(mediaFilesParser.getXmlNodeName());
            mediaFilesParser.parse(mediaFilesNode);

            MainDetailsXmlAdapter mainDetailsParser = new MainDetailsXmlAdapter(poi.getMainDetails());
            XmlNode mainDetailsNode = objNode.SelectSingleNode(mainDetailsParser.getXmlNodeName());
            mainDetailsParser.parse(mainDetailsNode);

            return poi;
        }
Exemplo n.º 8
0
 private void listBoxTargets_SelectedIndexChanged(object sender, EventArgs e)
 {
     int index = this.listBoxTargets.SelectedIndex;
     if (index < 0 || index >= this.listBoxTargets.Items.Count)
         return;
     this.selectedTargetPoi = (Poi)this.listBoxTargets.Items[index];
     this.buttonPreview2.Enabled = true;
     this.buttonRemove.Enabled = true;
     if (index > 0)
         this.buttonUp.Enabled = true;
     else
         this.buttonUp.Enabled = false;
     if (index < this.listBoxTargets.Items.Count - 1)
         this.buttonDown.Enabled = true;
     else
         this.buttonDown.Enabled = false;
 }
Exemplo n.º 9
0
 private void listBoxPois_SelectedIndexChanged(object sender, EventArgs e)
 {
     int index = this.listBoxPois.SelectedIndex;
     this.selectedPoi = (Poi)this.listBoxPois.Items[index];
     this.buttonPreview.Enabled = true;
     if (!this.listBoxTargets.Items.Contains(this.selectedPoi))
         this.buttonAddTarget.Enabled = true;
     else
         this.buttonAddTarget.Enabled = false;
 }
Exemplo n.º 10
0
Arquivo: Area.cs Projeto: mitice/foo
 // check if given poi is inside area
 public bool contains(Poi poi)
 {
     return(contains(poi.getLatitude(), poi.getLongitude()));
 }
Exemplo n.º 11
0
 public PoiPanel(Poi poi, MapPanel mapPanel)
 {
     this.poi = poi;
     this.mapPanel = mapPanel;
     initialize();
 }
Exemplo n.º 12
0
 /**
  * Returns poi sub dir by poi and named area
  */
 private string getPoiSubDir(Poi p, NamedArea namedArea)
 {
     string dirName = p.getName() + "_" + p.getLatitude() + "_" + p.getLongitude();
     return getPoiSubDir(dirName, namedArea);
 }
Exemplo n.º 13
0
 public void preview(Poi poi)
 {
     cleanPreview();
     if (poi.isMediaFree() || poi.isDataFree())
         this.poiRepository.load(poi);
     this.currentPoi = poi;
     this.freeY = FREE_Y_DEFAULT;
     updatePreview();
     this.tabControl.SelectedIndex = 1;
     //if (!this.Visible)
     this.Visible = true;
 }
Exemplo n.º 14
0
        public Point getPoiPixelCoordinates(Poi p)
        {
            double deltaLongitude = p.getLongitude() - this.area.getTopLeftLongitude();
            double deltaLatitude = this.area.getTopLeftLatitude() - p.getLatitude();

            int x = (int) Math.Floor(deltaLongitude / this.longitudePerPixel);
            int y = (int) Math.Floor(deltaLatitude / this.latitudePerPixel);
            return new Point(x, y);
        }
Exemplo n.º 15
0
 /**
  * Loads Poi media data: media files and main details.
  */
 public void loadMedia(Poi poi, string poiSubDir)
 {
     //Debug.WriteLine("loadMedia: poi sub dir: " + poiSubDir, ToString());
     // load xml document
     XmlDocument poiXmlDoc = new XmlDocument();
     string poiXmlPath = getPoiXmlPath(poiSubDir);
     poiXmlDoc.Load(poiXmlPath);
     // get media files
     XmlNode mediaFilesNode = poiXmlDoc.SelectSingleNode("/poi/media_files");
     if (mediaFilesNode != null)
     {
         MediaFilesXmlAdapter mfxa = new MediaFilesXmlAdapter(poi.getMediaFiles());
         mfxa.parse(mediaFilesNode);
     }
     // get main details
     XmlNode mainDetailsNode = poiXmlDoc.SelectSingleNode("/poi/details");
     if (mainDetailsNode != null)
     {
         MainDetailsXmlAdapter mdxa = new MainDetailsXmlAdapter(poi.getMainDetails());
         mdxa.parse(mainDetailsNode);
     }
     string poiMediaFilesPath = getPoiMediaFilesPath(poiSubDir);
     if (poiMediaFilesPath != null)
     {
         loadMediaFiles(poi.getAllMediaFiles(), poiMediaFilesPath);
     }
 }
Exemplo n.º 16
0
 public void save(Poi poi, string poiSubDir)
 {
     Debug.WriteLine("save: poi: " + poi, ToString());
     string poiXmlFilePath = createPoiXmlPath(poiSubDir);
     string poiMediaFilesPath = createPoiMediaFilesPath(poiSubDir);
     // serialize poi
     PoiXmlAdapter pxa = new PoiXmlAdapter();
     string poiXml = pxa.serialize(poi);
     // save poi's xml
     saveXml(poiXml, poiXmlFilePath);
     // save poi's media
     saveMediaFiles(poi.getAllMediaFiles(), poiMediaFilesPath);
 }
Exemplo n.º 17
0
 private Area createTargetArea(Poi target)
 {
     double topLeftLat = target.getLatitude() + maxLatitudeToTarget;
     double topLeftLon = target.getLongitude() - maxLongitudeToTarget;
     double bottomRightLat = target.getLatitude() - maxLatitudeToTarget;
     double bottomRightLon = target.getLongitude() + maxLongitudeToTarget;
     return new Area(topLeftLat, topLeftLon, bottomRightLat, bottomRightLon);
 }
Exemplo n.º 18
0
 internal void put(Poi p, NamedArea namedArea)
 {
     if (this.pois == null)
     {
         this.pois = new List<Poi>();
     }
     if (!p.isDataFree())
     {
         this.poiMapperHdd.save(p, getPoiSubDir(p, namedArea));
         p.free();
         //if (!this.pois.Contains(p))
         //{
             this.pois.Add(p);
         //}
     }
 }
Exemplo n.º 19
0
 private void removeTarget(Object sender, EventArgs args)
 {
     if (this.targetToRemove != null)
     {
         this.listBoxTargets.Items.Remove(this.targetToRemove);
         this.targetToRemove = null;
     }
 }
Exemplo n.º 20
0
Arquivo: Area.cs Projeto: misiek/foo
 // check if given poi is inside area
 public bool contains(Poi poi)
 {
     return contains(poi.getLatitude(), poi.getLongitude());
 }
Exemplo n.º 21
0
 private void targetDone(Poi target)
 {
     this.targetToRemove = target;
     this.listBoxTargets.Invoke(new EventHandler(removeTarget));
 }
Exemplo n.º 22
0
 public PoiDialogPanel(Poi poi)
 {
     this.poi = poi;
     initialize();
 }
Exemplo n.º 23
0
 public void setTarget(Poi currentTarget)
 {
     this.target = currentTarget;
 }
Exemplo n.º 24
0
 internal void loadData(Poi poi)
 {
     if (poi.isDataFree())
         this.poiMapperHdd.loadData(poi, getPoiSubDir(poi, this.currentNamedArea));
 }
Exemplo n.º 25
0
 public void load(Poi poi)
 {
     this.poiSourceHdd.loadData(poi);
     this.poiSourceHdd.loadMedia(poi);
 }
Exemplo n.º 26
0
 public void setTarget(Poi currentTarget)
 {
     this.target = currentTarget;
 }