Example #1
0
        // utility function - given a layerset, add all its placenamesets to the above collection, recursing into child layers
        private void collectTiledPlacenamesSets(LayerSet.Type_LayerSet curLayerSet)
        {
            if (curLayerSet.HasTiledPlacenameSet()) // any placenames at all?
            {
                // yes, iterate over them
                for (int i = 0; i < curLayerSet.TiledPlacenameSetCount; i++)
                {
                    // get tilesplacenameset
                    LayerSet.Type_TiledPlacenameSet2 tpns = curLayerSet.GetTiledPlacenameSetAt(i);

                    // compute full path to wpl file - WplIndex constructor needs this
                    string wplFullPath = Path.Combine(MainApplication.DirectoryPath, tpns.PlacenameListFilePath.Value);

                    // build an index descriptor (does not create or load the index yet)
                    WplIndex idx = new WplIndex(tpns, wplFullPath);

                    // an indexedTilePlacenameSet associates the index descriptor with the placenameset
                    IndexedTiledPlaceNameSet ipns = new IndexedTiledPlaceNameSet(tpns, idx);

                    // add them to our collection
                    this.indexedTiledPlacenameSets.Add(ipns);
                }
            }

            // now recurse into child layers of this set and do the same
            if (curLayerSet.HasChildLayerSet())
            {
                for (int i = 0; i < curLayerSet.ChildLayerSetCount; i++)
                {
                    this.collectTiledPlacenamesSets(curLayerSet.GetChildLayerSetAt(i));
                }
            }
        }
Example #2
0
            /// <summary>
            /// Creates a new IndexEntryToStringComparer
            /// </summary>
            /// <param name="theIndex">The index the comparer will work withz</param>
            /// <param name="bPartialAllowed">Set to true if partial matches are allowed.</param>
            public IndexEntryToStringComparer(WplIndex theIndex, bool bPartialAllowed)
            {
                // remember the index we are working with
                myWplIndex = theIndex;

                // are partial matches allowed?
                partialAllowed = bPartialAllowed;
            }
Example #3
0
        // perform a full search in a placename set, with attributes
        bool PlaceNameSetFullSearch(string [] searchTokens, IndexedTiledPlaceNameSet curIndexedTiledSet)
        {
            DirectoryInfo dir = new DirectoryInfo(Path.GetDirectoryName(
                                                      Path.Combine(
                                                          Path.GetDirectoryName(Application.ExecutablePath),
                                                          curIndexedTiledSet.placenameSet.PlacenameListFilePath.Value)));

            // ignore this set if the corresponding directory does not exist for some reason
            if (!dir.Exists)
            {
                return(true);
            }

            // loop over all WWP files in directory
            foreach (FileInfo placenameFile in dir.GetFiles("*.wwp"))
            {
                using (BinaryReader reader = new BinaryReader(placenameFile.OpenRead()))
                {
                    int placenameCount = reader.ReadInt32();

                    // loop over all places
                    for (int i = 0; i < placenameCount; i++)
                    {
                        // return false if stop requested
                        if (CheckStopRequested())
                        {
                            return(false);
                        }

                        // instantiate and read current placename
                        WorldWindPlacename pn = new WorldWindPlacename();
                        WplIndex.ReadPlaceName(reader, ref pn, WplIndex.MetaDataAction.Store);

                        // if we have a match ...
                        if (isPlaceMatched(searchTokens, pn))
                        {
                            if (CheckMaxResults())
                            {
                                return(false);
                            }

                            PlaceItem pi = new PlaceItem();
                            pi.pn = pn;
                            pi.placeDescriptor = curIndexedTiledSet.placenameSet;

                            // add item via delegate to avoid MT issues
                            listViewResults.Invoke(listViewResults.addPlaceDelegate, new object[] { pi });
                        }
                    }
                }
            }
            return(true); // go on
        }
Example #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref= "T:WorldWind.IndexedTiledPlaceNameSet"/> class.
 /// Initializes placenameset and index.
 /// </summary>
 /// <param name="pns"></param>
 /// <param name="idx"></param>
 public IndexedTiledPlaceNameSet(LayerSet.Type_TiledPlacenameSet2 pns, WplIndex idx)
 {
     placenameSet = pns;
     wplIndex     = idx;
 }
Example #5
0
      // utility function - given a layerset, add all its placenamesets to the above collection, recursing into child layers
      private void collectTiledPlacenamesSets(LayerSet.Type_LayerSet curLayerSet)
      {
         if(curLayerSet.HasTiledPlacenameSet()) // any placenames at all?
         {
            // yes, iterate over them
            for(int i = 0; i < curLayerSet.TiledPlacenameSetCount; i++)
            {
               // get tilesplacenameset
               LayerSet.Type_TiledPlacenameSet2 tpns = curLayerSet.GetTiledPlacenameSetAt(i);

               // compute full path to wpl file - WplIndex constructor needs this
               string wplFullPath = Path.Combine(MainApplication.DirectoryPath, tpns.PlacenameListFilePath.Value);

               // build an index descriptor (does not create or load the index yet)
               WplIndex idx = new WplIndex(tpns, wplFullPath);

               // an indexedTilePlacenameSet associates the index descriptor with the placenameset
               IndexedTiledPlaceNameSet ipns = new IndexedTiledPlaceNameSet(tpns, idx);

               // add them to our collection
               this.indexedTiledPlacenameSets.Add(ipns);
            }
         }
			
         // now recurse into child layers of this set and do the same
         if(curLayerSet.HasChildLayerSet())
         {
            for(int i = 0; i < curLayerSet.ChildLayerSetCount; i++)
            {
               this.collectTiledPlacenamesSets(curLayerSet.GetChildLayerSetAt(i));
            }
         }
      }
Example #6
0
		 /// <summary>
		 /// Initializes a new instance of the <see cref= "T:WorldWind.IndexedTiledPlaceNameSet"/> class. 
		 /// Initializes placenameset and index.
		 /// </summary>
		 /// <param name="pns"></param>
		 /// <param name="idx"></param>
      public IndexedTiledPlaceNameSet(LayerSet.Type_TiledPlacenameSet2 pns, WplIndex idx) 
      {
         placenameSet = pns;
         wplIndex = idx;
      }
Example #7
0
         /// <summary>
         /// Creates a new IndexEntryToStringComparer
         /// </summary>
         /// <param name="theIndex">The index the comparer will work withz</param>
         /// <param name="bPartialAllowed">Set to true if partial matches are allowed.</param>
         public IndexEntryToStringComparer(WplIndex theIndex, bool bPartialAllowed) 
         {
            // remember the index we are working with
            myWplIndex = theIndex;

            // are partial matches allowed?
            partialAllowed = bPartialAllowed;
         }