/// <summary> /// The main function which creates the Raster Type object. /// </summary> /// <param name="RasterTypeName">Name of the Raster Type to create.</param> /// <returns></returns> public IRasterType CreateRasterType(string RasterTypeName) { try { switch (RasterTypeName) { case "Thumbnail Raster Dataset": { // Create a Raster Type Name object. IRasterTypeName theRasterTypeName = new RasterTypeNameClass(); // Assign the name of the built-in Raster Type to the name object. // The Name field accepts a path to an .art file as well // the name for a built-in Raster Type. theRasterTypeName.Name = RasterTypeName.Replace("Thumbnail ", ""); // Use the Open function from the IName interface to get the Raster Type object. IRasterType theRasterType = (IRasterType)(((IName)theRasterTypeName).Open()); if (theRasterType == null) { Console.WriteLine("Error:Raster Type not found " + theRasterTypeName.Name); return(null); } // Create a new ThumbnailBuilder object and set it's InnerRasterBuilder property to // the RasterBuilder from the RasterType object. Then set the thumbnail builder to // be the RasterBuilder for the RasterType object. This inserts the thumbnail builder in // between the RasterType and it's RasterBuilder. // Create the Thumbnail Builder IRasterBuilder thumbnailBuilder = new ThumbnailBuilder(); // Set the InnerRasterBuilder property with current Raster Type's Raster Builder ((ThumbnailBuilder)thumbnailBuilder).InnerRasterBuilder = theRasterType.RasterBuilder; // Set the Raster Builder of theRasterType to the above created thumbnail builder. theRasterType.RasterBuilder = thumbnailBuilder; IName theName = theRasterType.FullName; ((IRasterTypeName)theName).Name = "Thumbnail Raster Dataset"; return(theRasterType); } case "Thumbnail QuickBird": { // Create a Raster Type Name object. IRasterTypeName theRasterTypeName = new RasterTypeNameClass(); // Assign the name of the built-in Raster Type to the name object. // The Name field accepts a path to an .art file as well // the name for a built-in Raster Type. theRasterTypeName.Name = RasterTypeName.Replace("Thumbnail ", ""); // Use the Open function from the IName interface to get the Raster Type object. IRasterType theRasterType = (IRasterType)(((IName)theRasterTypeName).Open()); if (theRasterType == null) { Console.WriteLine("Error:Raster Type not found " + theRasterTypeName.Name); return(null); } // Create a new TumbnailBuilder object and set it's InnerRasterBuilder property to // the RasterBuilder from the RasterType object. Then set the thumbnail builder to // be the RasterBuilder for the RasterType object. This inserts the thumbnail builder in // between the RasterType and it's RasterBuilder. // Create the Thumbnail Builder IRasterBuilder thumbnailBuilder = new ThumbnailBuilder(); // Set the InnerRasterBuilder property with current Raster Type's Raster Builder ((ThumbnailBuilder)thumbnailBuilder).InnerRasterBuilder = theRasterType.RasterBuilder; // Set the Raster Builder of theRasterType to the above created thumbnail builder. theRasterType.RasterBuilder = thumbnailBuilder; IName theName = theRasterType.FullName; ((IRasterTypeName)theName).Name = "Thumbnail QuickBird"; return(theRasterType); } default: return(null); } } catch (Exception ex) { throw new Exception("Error: Failed to create " + RasterTypeName + ": " + ex.Message); } }
/// <summary> /// The main function which creates the Raster Type object. /// </summary> /// <param name="RasterTypeName">Name of the Raster Type to create.</param> /// <returns></returns> public IRasterType CreateRasterType(string RasterTypeName) { try { switch (RasterTypeName) { case "Thumbnail Raster Dataset": { // Create a Raster Type Name object. IRasterTypeName theRasterTypeName = new RasterTypeNameClass(); // Assign the name of the built-in Raster Type to the name object. // The Name field accepts a path to an .art file as well // the name for a built-in Raster Type. theRasterTypeName.Name = RasterTypeName.Replace("Thumbnail ", ""); // Use the Open function from the IName interface to get the Raster Type object. IRasterType theRasterType = (IRasterType)(((IName)theRasterTypeName).Open()); if (theRasterType == null) { Console.WriteLine("Error:Raster Type not found " + theRasterTypeName.Name); return null; } // Create a new ThumbnailBuilder object and set it's InnerRasterBuilder property to // the RasterBuilder from the RasterType object. Then set the thumbnail builder to // be the RasterBuilder for the RasterType object. This inserts the thumbnail builder in // between the RasterType and it's RasterBuilder. // Create the Thumbnail Builder IRasterBuilder thumbnailBuilder = new ThumbnailBuilder(); // Set the InnerRasterBuilder property with current Raster Type's Raster Builder ((ThumbnailBuilder)thumbnailBuilder).InnerRasterBuilder = theRasterType.RasterBuilder; // Set the Raster Builder of theRasterType to the above created thumbnail builder. theRasterType.RasterBuilder = thumbnailBuilder; IName theName = theRasterType.FullName; ((IRasterTypeName)theName).Name = "Thumbnail Raster Dataset"; return theRasterType; } case "Thumbnail QuickBird": { // Create a Raster Type Name object. IRasterTypeName theRasterTypeName = new RasterTypeNameClass(); // Assign the name of the built-in Raster Type to the name object. // The Name field accepts a path to an .art file as well // the name for a built-in Raster Type. theRasterTypeName.Name = RasterTypeName.Replace("Thumbnail ", ""); // Use the Open function from the IName interface to get the Raster Type object. IRasterType theRasterType = (IRasterType)(((IName)theRasterTypeName).Open()); if (theRasterType == null) { Console.WriteLine("Error:Raster Type not found " + theRasterTypeName.Name); return null; } // Create a new TumbnailBuilder object and set it's InnerRasterBuilder property to // the RasterBuilder from the RasterType object. Then set the thumbnail builder to // be the RasterBuilder for the RasterType object. This inserts the thumbnail builder in // between the RasterType and it's RasterBuilder. // Create the Thumbnail Builder IRasterBuilder thumbnailBuilder = new ThumbnailBuilder(); // Set the InnerRasterBuilder property with current Raster Type's Raster Builder ((ThumbnailBuilder)thumbnailBuilder).InnerRasterBuilder = theRasterType.RasterBuilder; // Set the Raster Builder of theRasterType to the above created thumbnail builder. theRasterType.RasterBuilder = thumbnailBuilder; IName theName = theRasterType.FullName; ((IRasterTypeName)theName).Name = "Thumbnail QuickBird"; return theRasterType; } default: return null; } } catch (Exception ex) { throw new Exception("Error: Failed to create " + RasterTypeName + ": " + ex.Message); } }