/// <summary> /// full constructor for InsertWaypoint type of action /// </summary> /// <param name="createInfo"></param> public Waypoint(CreateInfo createInfo) { m_id = nextWaypointId++; m_dateTime = createInfo.dateTime; m_location = new GeoCoord(createInfo.lng, createInfo.lat, createInfo.elev); if(createInfo.typeExtra == null) { switch(createInfo.type) // null, "wpt", "rtept", "trkpt", "geocache", "earthquake" { default: case "earthquake": case "wpt": LiveObjectType = LiveObjectTypes.LiveObjectTypeWaypoint; break; case "geocache": LiveObjectType = LiveObjectTypes.LiveObjectTypeGeocache; break; case "rtept": LiveObjectType = LiveObjectTypes.LiveObjectTypeRoutepoint; break; case "trkpt": LiveObjectType = LiveObjectTypes.LiveObjectTypeTrackpoint; break; } } else { string typeExtra = createInfo.typeExtra.ToLower().Trim(); // can be "geocache found" or "geocache|traditional cache|found" if(typeExtra.IndexOf("geocache") != -1) { LiveObjectType = LiveObjectTypes.LiveObjectTypeGeocache; } else { switch(createInfo.type) // null, "wpt", "rtept", "trkpt" { default: case "wpt": LiveObjectType = LiveObjectTypes.LiveObjectTypeWaypoint; break; case "rtept": LiveObjectType = LiveObjectTypes.LiveObjectTypeRoutepoint; break; case "trkpt": LiveObjectType = LiveObjectTypes.LiveObjectTypeTrackpoint; break; } } if(typeExtra.IndexOf("found") != -1) { m_found = true; } m_wptType = createInfo.typeExtra.Trim(); } m_sym = createInfo.sym == null ? "" : createInfo.sym; m_desc = createInfo.desc == null ? "" : createInfo.desc; m_wptName = createInfo.name == null ? "" : createInfo.name; m_comment = createInfo.comment == null ? "" : createInfo.comment; m_trackId = createInfo.id; m_url = createInfo.url == null ? "" : createInfo.url; m_wptGuid = extractGuid(createInfo.url); // pocket queries have GUID-based URLs, get guid for Tools sring m_urlName = createInfo.urlName == null ? "" : createInfo.urlName; m_source = createInfo.source == null ? "" : createInfo.source; if(createInfo.node1 != null) { groundspeakCache = new GroundspeakCache(createInfo.node1); } Name = getLabel(false); setBrushes(); }
/// <summary> /// clone constructor /// </summary> /// <param name="wpt"></param> public Waypoint(Waypoint wpt) { m_id = nextWaypointId++; m_location = new GeoCoord(wpt.Location); m_dateTime = wpt.DateTime; // always UTC; value type is copied m_trackId = wpt.TrackId; m_forceShow = wpt.ForceShow; m_found = wpt.Found; LiveObjectType = wpt.LiveObjectType; m_name = wpt.m_name; m_wptName = wpt.m_wptName; m_wptType = wpt.m_wptType; m_sym = wpt.m_sym; m_comment = wpt.m_comment; m_desc = wpt.m_desc; m_source = wpt.m_source; m_url = wpt.m_url; m_urlName = wpt.m_urlName; m_thumbImage = wpt.ThumbImage == null ? null : new Bitmap(wpt.ThumbImage); m_thumbSource = wpt.ThumbSource; m_thumbPosition = wpt.ThumbPosition; m_photoTimeShift = wpt.PhotoTimeShift; groundspeakCache = wpt.groundspeakCache; // by reference setBrushes(); }