Learning the ten usage sets of building applications with FME objects

Source: Internet
Author: User

The gfme object API contains the following collection objects:

Fmeostringarray, fmeofeaturevector, and fmeorectanglevector.

These objects are mainly used to move data. For example, as a parameter or return value, these objects are not used to replace the set in VB.

 

If your FME object applicationProgramWe plan to use other collection objects for processing. You can convert your existing collection to the FME object set during the write process. For example, the following featurevectortocollection process copies the fmeofeaturevector object to the VB collection object:

sub featurevectortocollection (byref colfeatures as collection)
dim I as integer
dim lcount as integer
lcount = m_fmefeaturevector.entries
for I = 0 to lcount-1
If I = 0 then
call colfeatures. add (m_fmefeaturevector.element (I)
else
call colfeatures. add (_
m_fmefeaturevector.element (I), I)
end if
next I
end sub

Note: The aboveCodeThe IF statement in for is used to control the order of elements. If the order is not important, you can delete the if statement to improve performance.

 

This example shows an important difference between a FME object set object and a VB set object: a fme object uses a 0-based index, and a VB uses a 1-based index.

 

In this chapter, we will learn:

    • Use ractangle and feature vector Sets
    • String collection

 

Use Vector Sets

The fmeofeaturevector and fmeorectanglevector collections are similar. The only difference is that the former saves the fmeofeature object, the latter saves the fmeorectangle object, and the fmeorectanglevector methods and attributes, for example:

 

The following lists the attributes and methods:

If your program operates on a large dataset, you should consider replacing fmeofeaturevectorondisk with fmeofeaturevecvecdisk with a disk instead of the memory storage elements, so that your application operates on large data without being limited by computer virtual memory, the methods and attributes of fmeofeaturevecw.disk are as follows:

 

 

Use string collection

Fmeostringarray collection objects store string objects. Most FME object methods and attributes use string arrays as parameters for input and output. The methods and attributes of this object are as follows:

 

The following code contains nine elements in an array: string1, "string 2", AAA, BBB, CCC, <null>, eee, XXX, and YYYY .:

Set fmearray = m_fmesession.createstringarray
Sdelimiter = ";;"
Stoken = ""

S1 = "string1"
S2 = "" string 2 """
S3 = "AAA; BBB; CCC; eee"
S4 = "xxx yyyy"
Call fmearray. append (S1)
Call fmearray. append (S2)
Call fmearray. appendcsvstring (S3, sdelimiter)
Call fmearray. appendtokenizestring (S4, en)

References:

Building applications with FME objects February 2005

reprinted please indicate Article source http://www.cnblogs.com/booolee

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.