The idea is as follows:
1) The ge com api does not provide an interface for adding objects directly. Therefore, we can only load objects using the kml file openkmlfile/loadkmldata method;
2) The loaded objects are stored in the temporary position (temporaryplaces) without a special declaration, therefore, we want to delete the previously painted features by modifying kml to load the same object;
The procedure is as follows:
(1) Parse kml in the form of parsing XML (you must be familiar with the kml label first) and implement it using the xmldocument or LINQ to XML-related component interfaces, you can return the file path name or direct XML memory file (for openkmlfile/loadkmldata );
(2) After kml is added, use the featurege interface to obtain the elements (applicationgeclass. gettemporaryplaces (). Here, you can only use visibility to hide the elements. Of course, you can also directly set them in kml.
(3) Empty mode. Design a variable. Here we should follow the XML syntax. Use this empty variable to replace the kml added to the GE Interface and load the variable to the GE Interface, implement the so-called "clear" function.