Hi,
These approaches flashed in my mind.
1. AttributeCreator with the "Prior/Subsequent Feature Attribute Retrieval (Multiple Feature Attribute Support)" option and the "Conditional Value" setting
(1) AttributeExposer
Attribute To Expose: _line_id
(2) AttributeCreator
Number of Prior Features: 1
If Attribute is Missing, Null, or Empty: Use Fallback Value
Fallback Value: 0
Attributes To Set (Conditional Value Setting):
_line_id = If _attr = A+ Then featureT-1]._line_id + 1 Else featureE-1]._line_id
(3) PointConnector (Connection Break Point: _line_id)
2. VariableSetter/VariableRetriever
(1) Sampler
Sampling Type: First N Features
Sampling Amount: 1
(2) VariableSetter (for the "Sampled" feature, i.e. the first feature)
VariableName: vLineId
Value: 1
(3) VariableRetriever (for every feature)
VariableName: vLineId
Attribute ReceivingValue: _line_id
(4) VariableSetter_2
VariableName: vLineId
Value (Conditional Value setting):
If _attr = A- Then _line_id + 1 Else _line_id
(5) PointConnector (Connection Break Point: _line_id)
3. PythonCaller
-----
class FeatureProcessor(object):
def __init__(self):
self.line = None
def input(self, feature):
attr = feature.getAttribute('_attr')
if attr == 'A+': # start
self.line = feature
elif self.line != None:
self.line.addCoordinate(*feature.getCoordinate(0))
if attr == 'A-': # end
self.pyoutput(self.line)
self.line = None
-----
Takashi
Regarding the VariableSetter/Retriever approach, this may be smarter than the previous one.