Exemple #1
0
        private void rebuildMarkers(GMapOverlay overlay, int size)
        {
            overlay.Markers.Clear();
            GMapMarker[] markers = overlayDict[overlay.Id];


            int       count = markers.Length;
            MarkerTag tag   = (MarkerTag)markers[0].Tag;

            tag.Size = size;

            int step = getStep(size);

            //tag.getBitmap().Dispose();
            tag.setBitmap();
            Bitmap bitmap = tag.getBitmap();

            for (int i = 0; i < count - 1; i += step)
            {
                GMapMarker marker    = markers[i];
                GMapMarker newMarker = new GMarkerGoogle(marker.Position, bitmap);
                if (marker.Tag != null)
                {
                    newMarker.Tag = marker.Tag;
                }
                overlay.Markers.Add(newMarker);
            }
        }
Exemple #2
0
        private GMapOverlay buildPhotoMarker(GMapOverlay overlay, MarkerTag tag, String name)
        {
            Bitmap bitmap = tag.getBitmap();

            foreach (string filePath in mFiles)
            {
                try
                {
                    Image          image          = new Bitmap(filePath);
                    PropertyItem[] propItems      = image.PropertyItems;
                    PropertyItem   propItemLatRef = image.GetPropertyItem(0x0001);
                    PropertyItem   propItemLat    = image.GetPropertyItem(0x0002);
                    PropertyItem   propItemLonRef = image.GetPropertyItem(0x0003);
                    PropertyItem   propItemLon    = image.GetPropertyItem(0x0004);
                    image.Dispose();
                    byte[] latBytes    = propItemLat.Value;
                    byte[] latRefBytes = propItemLatRef.Value;
                    byte[] lonBytes    = propItemLon.Value;
                    byte[] lonRefBytes = propItemLonRef.Value;

                    string latitudeRef  = ASCIIEncoding.UTF8.GetString(latRefBytes);
                    string longitudeRef = ASCIIEncoding.UTF8.GetString(lonRefBytes);

                    double latitude  = byteToDegrees(latBytes);
                    double longitude = byteToDegrees(lonBytes);
                    if (latitudeRef.Equals("S\0"))
                    {
                        latitude = -latitude;
                    }
                    if (longitudeRef.Equals("W\0"))
                    {
                        longitude = -longitude;
                    }
                    GMapMarker marker = new GMarkerGoogle(new PointLatLng(latitude, longitude), bitmap);
                    marker.Tag = tag;
                    overlay.Markers.Add(marker);
                } catch (ArgumentException ex) {
                }
                catch (NullReferenceException ex)
                {
                    txtConsole.AppendText(ex.StackTrace);
                }
            }
            txtConsole.AppendText("Photos ready.." + Environment.NewLine);
            return(overlay);
        }
Exemple #3
0
        private GMapOverlay buildMarker(GMapOverlay overlay, MarkerTag tag, String name)
        {
            Bitmap bitmap = tag.getBitmap();

            if (mRecordDict != null)
            {
                foreach (KeyValuePair <string, Record> record in mRecordDict)
                {
                    Double lat = record.Value.Latitude;
                    Double lon = record.Value.Longitude;

                    GMapMarker marker = new GMarkerGoogle(new PointLatLng(lat, lon), bitmap);
                    marker.Tag = tag;
                    overlay.Markers.Add(marker);
                    //markerArray.Add(marker);
                }
            }
            //bitmap.Dispose();
            return(overlay);
        }