本文整理汇总了C++中segmentstring::NonConstVect::push_back方法的典型用法代码示例。如果您正苦于以下问题:C++ NonConstVect::push_back方法的具体用法?C++ NonConstVect::push_back怎么用?C++ NonConstVect::push_back使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类segmentstring::NonConstVect
的用法示例。
在下文中一共展示了NonConstVect::push_back方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: tmp
/*public*/
Geometry*
BufferBuilder::bufferLineSingleSided( const Geometry* g, double distance,
bool leftSide )
{
// Returns the line used to create a single-sided buffer.
// Input requirement: Must be a LineString.
const LineString* l = dynamic_cast< const LineString* >( g );
if ( !l ) throw util::IllegalArgumentException("BufferBuilder::bufferLineSingleSided only accept linestrings");
// Get geometry factory and precision model.
const PrecisionModel* precisionModel = workingPrecisionModel;
if ( !precisionModel ) precisionModel = l->getPrecisionModel();
assert( precisionModel );
assert( l );
geomFact = l->getFactory();
// First, generate the two-sided buffer using a butt-cap.
BufferParameters modParams = bufParams;
modParams.setEndCapStyle(BufferParameters::CAP_FLAT);
Geometry* buf = 0;
// This is a (temp?) hack to workaround the fact that
// BufferBuilder BufferParamaters are immutable after
// construction, while we want to force the end cap
// style to FLAT for single-sided buffering
{
BufferBuilder tmp(modParams);
buf = tmp.buffer( l, distance );
}
// Create MultiLineStrings from this polygon.
Geometry* bufLineString = buf->getBoundary();
#ifdef GEOS_DEBUG_SSB
std::cerr << "input|" << *l << std::endl;
std::cerr << "buffer|" << *bufLineString << std::endl;
#endif
// Then, get the raw (i.e. unnoded) single sided offset curve.
OffsetCurveBuilder curveBuilder( precisionModel, modParams );
std::vector< CoordinateSequence* > lineList;
std::auto_ptr< CoordinateSequence > coords ( g->getCoordinates() );
curveBuilder.getSingleSidedLineCurve( coords.get(), distance,
lineList, leftSide, !leftSide );
coords.reset();
// Create a SegmentString from these coordinates.
SegmentString::NonConstVect curveList;
for ( unsigned int i = 0; i < lineList.size(); ++i )
{
CoordinateSequence* seq = lineList[i];
SegmentString* ss = new NodedSegmentString(seq, NULL);
curveList.push_back( ss );
}
// Node these SegmentStrings.
Noder* noder = getNoder( precisionModel );
noder->computeNodes( &curveList );
SegmentString::NonConstVect* nodedEdges = noder->getNodedSubstrings();
// Create a geometry out of the noded substrings.
std::vector< Geometry* >* singleSidedNodedEdges =
new std::vector< Geometry * >();
for ( unsigned int i = 0, n = nodedEdges->size(); i < n; ++i )
{
SegmentString* ss = ( *nodedEdges )[i];
Geometry* tmp = geomFact->createLineString(
ss->getCoordinates()->clone()
);
singleSidedNodedEdges->push_back( tmp );
}
if ( nodedEdges != &curveList ) delete nodedEdges;
for (size_t i=0, n=curveList.size(); i<n; ++i) delete curveList[i];
curveList.clear();
for (size_t i=0, n=lineList.size(); i<n; ++i) delete lineList[i];
lineList.clear();
Geometry* singleSided = geomFact->createMultiLineString(
singleSidedNodedEdges );
#ifdef GEOS_DEBUG_SSB
std::cerr << "edges|" << *singleSided << std::endl;
#endif
// Use the boolean operation intersect to obtain the line segments lying
// on both the butt-cap buffer and this multi-line.
//Geometry* intersectedLines = singleSided->intersection( bufLineString );
// NOTE: we use Snapped overlay because the actual buffer boundary might
// diverge from original offset curves due to the addition of
// intersections with caps and joins curves
//.........这里部分代码省略.........