Ways to read style symbol library styles

Source: Internet
Author: User

It was usually custom symbol when it was used, or it was chosen using Symbologycontrol, so let's read the style in the style manager as it is actually needed. Open in ArcMap as follows: There are many style classes under the style, each with a variety of styles underneath it.

To read the style symbol library styles, follow these steps:

The first step is to get the location of the style, usually under the ArcGIS installation directory, with a sytles folder. For information about obtaining an ArcGIS installation path, see: Getting an ArcGIS installation path

The second step, the new style management set Tool Stylegallery, and specify the style file location;

The third step is to traverse the Get style file class, which is the 22 class under the Style manager Esri.style, where we want to get the name "Fill Symbols";

Fourth step, traverse the style file class named "10% simple Hatch" style file, and return to symbol.

Fifth, symbolize the feature layer: Assign symbol to Simplerenderer's symbol property, convert the layer to Geofeaturelayer, assign simplerenderer to the Renderer property of Geofeaturelayer, Load the display geofeaturelayer in the map.

<summary>

get the specified symbol from the style symbol library

</summary>

<param name= "Sserverstylepath" > symbol Library path </param>

<param name= "Sgalleryclassname" > style class name </param>

<param name= "Symbolname" > style name </param>

<returns>Symbol</returns>

Public Isymbol Getsymbol (string sserverstylepath, string sgalleryclassname, string symbolname)

{

1. Loading style files

isymbol psymbol = null;

istylegallery pstylegaller = newserverstylegallery(); //Style management set Tool

istylegallerystorage pstylegallerystorage = Pstylegaller asistylegallerystorage; //Style file management

Pstylegallerystorage.targetfile = Sserverstylepath; //serverstylepath is a string type that represents the Serverstyle file location

?

2. Get style subclasses

You can do this by traversing the subclass in the style file and then finding the same style subclass as the target subclass name.

istylegalleryclass pstylegalleryclass = null; //Style sub-class object

for (int i = 0; i < Pstylegaller.classcount; i++)

{

Pstylegalleryclass = Pstylegaller.get_class (i);

if (Pstylegalleryclass.name! = sgalleryclassname)

continue;

ienumstylegalleryitem penumsylegalleryitem = Pstylegaller.get_items (Sgalleryclassname, SServerStylePath, ""); //Get style subclass

Penumsylegalleryitem.reset ();

?

3. Traverse Penumsylegalleryitem

istylegalleryitem pstylegalleritem = null;

Pstylegalleritem = Penumsylegalleryitem.next ();

while (Pstylegalleritem! = null)

{

Console. WriteLine (Pstylegalleritem.name);

if (Pstylegalleritem.name = = symbolname)

{

4. Get symbols

Psymbol = Pstylegalleritem.item asisymbol;

break;

}

Pstylegalleritem = Penumsylegalleryitem.next ();

}

}

return Psymbol;

}

Call:

Getsymbol (ESRI. ArcGIS. Runtimemanager. Activeruntime.path + @ "\\Styles\\ESRI. Serverstyle "," Fill Symbols "," 10% simple Hatch ");

Of course, it's better to use Symbologycontrol for interactive experience!

This article refers to:

http://blog.csdn.net/rrrrssss00/article/details/6167497#

Http://blog.sina.com.cn/s/blog_694deb730100nhna.html

Ways to read style symbol library styles

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.