nasirgul
04-13-2008, 11:01 AM
Hello,
I am new to Mappoint. I want to know how to delete continuous pushpin. Like if I will insert lat & lon and when I will insert next time I want mine previous pushpin be deleted. I tried but it keep on deleting my new add pushpin. Please let me know how to overcome this problem. I am using C#.
Hope to hear from you people.
Gul
Wilfried
04-14-2008, 04:50 AM
Hi,
a Pushpin has a Delete method. So if you have somewhere:
PushPin pp = MP.ActiveMap.AddPushpin(location, name);
pp.Delete();
you can also hold an array of your pushpins. Or you can find a specific pushpin to delete with FindPushpin() method.
If you want to move a pushpin or replace it then you can also change the Location property of it to move it to a next location on the map. Less resources and it saves time.
nasirgul
04-14-2008, 08:56 AM
Hello,
Thanks Wilfried. Well with find pushpin I cant able to delete all previous pushpins generated by GPS and only plot pushpin that is in the visible area. I want to keep mine exact position pushpin and delete the previous pushpins. With PP.Delete(); i can able to delete but I am interested to keep my location pushpin and delete others.
Nasir
Hi,
a Pushpin has a Delete method. So if you have somewhere:
PushPin pp = MP.ActiveMap.AddPushpin(location, name);
pp.Delete();you can also hold an array of your pushpins. Or you can find a specific pushpin to delete with FindPushpin() method.
If you want to move a pushpin or replace it then you can also change the Location property of it to move it to a next location on the map. Less resources and it saves time.
Mattys Consulting
04-14-2008, 09:20 AM
nasirgul,
Try deleting the "My PushPins" dataset before adding a new pushpin.
Mike Mattys
nasirgul
04-14-2008, 12:28 PM
Hello,
I tried with the below code but pushpin appears and invisible within second.
if (radioButton1.Checked)
{
MapPoint.Location loc = axMappointControl1.ActiveMap.Location;
double Lat = Convert.ToDouble(this.textBox1.Text as string);
double Lon = Convert.ToDouble(this.textBox2.Text as string);
loc = axMappointControl1.ActiveMap.GetLocation(Lat, Lon, Altitude);
loc.GoTo();
// MapPoint.Pushpin currPushpin = null;
//currPushpin = axMappointControl1.ActiveMap.AddPushpin(loc, "mylocation");
// currPushpin = axMappointControl1.ActiveMap.AddPushpin(loc, "hi");
//MapPoint.DataSets ds = axMappointControl1.ActiveMap.DataSets;
object o = "My Pushpins";
try
{
MapPoint.Pushpin hi = null;
hi = axMappointControl1.ActiveMap.AddPushpin(loc, "hi");
MapPoint.DataSet myPushpins = axMappointControl1.ActiveMap.DataSets.get_Item(ref o);
MapPoint.Recordset rs = axMappointControl1.ActiveMap.DataSets.get_Item(ref o).QueryAllRecords();
rs.MoveFirst();
//rs.MoveNext();
while (!rs.EOF)
{
//rs.Pushpin.GoTo();
rs.Pushpin.Delete();
rs.MoveNext();
}
}
catch
{
}
}
Nasir
nasirgul,
Try deleting the "My PushPins" dataset before adding a new pushpin.
Mike Mattys
Mattys Consulting
04-14-2008, 12:57 PM
I don't speak .Net yet.
Concept is:
Default dataset is My Pushpins, so delete the dataset
When unassigned pin is added, MapPoint must recreate My Pushpins
to add the new pin.
You might also assign a more visible pushpin symbol.
Mike Mattys
nasirgul
04-15-2008, 09:09 PM
Hi,
I cant able to resolve the problem of deleting previous pushpin and get mine visible pushpin only. Iam intrested to delete all previous pushpins generated by GPS and only want to show pushpin that is in the visible area.I tried for deleting PP dataset and then add new one but not able to get control on program. ....please let me help to come out of this problem.
object o = "Pushpins";
Pushpin a =null;
a= axMappointControl1.ActiveMap.AddPushpin(loc, "hi");
try
{
//MapPoint.DataSet Pushpins = axMappointControl1.ActiveMap.DataSets.get_Item(ref o);
MapPoint.Recordset rs = axMappointControl1.ActiveMap.DataSets.get_Item(ref o).QueryAllRecords();
MapPoint.DataSet pushpin = axMappointControl1.ActiveMap.DataSets.AddPushpinSe t("new");
a.Delete();
rs.MoveFirst();
while (!rs.EOF)
{
axMappointControl1.ActiveMap.DataSets.ZoomTo();
rs.Pushpin.MoveTo(pushpin);
rs.MoveNext();
}
}
catch { }
}
Hi,
a Pushpin has a Delete method. So if you have somewhere:
PushPin pp = MP.ActiveMap.AddPushpin(location, name);
pp.Delete();you can also hold an array of your pushpins. Or you can find a specific pushpin to delete with FindPushpin() method.
If you want to move a pushpin or replace it then you can also change the Location property of it to move it to a next location on the map. Less resources and it saves time.
Wilfried
04-16-2008, 04:59 AM
Hi,
I answered in other thread on how to delete all pushpins.