code: int addPathFromMultiPath(MultiPath multi_path, int ipath, boolean as_polygon) {
  		int newgeom = createGeometry(as_polygon ? Geometry.Type.Polygon
  				: Geometry.Type.Polyline, multi_path.getDescription());
  
  		MultiPathImpl mp_impl = (MultiPathImpl) multi_path._getImpl();
  		if (multi_path.getPathSize(ipath) < 2)
  			return newgeom; //return empty geometry
  
  		// m_vertices->reserve_rounded(m_vertices->get_point_count() +
  		// multi_path.get_path_size(ipath));//ensure reallocation happens by
  		// blocks so that already allocated vertices do not get reallocated.
  		m_vertices_mp.add(multi_path, multi_path.getPathStart(ipath),
  				mp_impl.getPathEnd(ipath));
  		m_xy_stream = (AttributeStreamOfDbl) m_vertices
  				.getAttributeStreamRef(VertexDescription.Semantics.POSITION);
  
  		int path = insertPath(newgeom, -1);
  		setClosedPath(path, mp_impl.isClosedPath(ipath) || as_polygon);
  
  		boolean b_some_segments = m_segments != null
  				&& mp_impl.getSegmentFlagsStreamRef() != null;
  
  		for (int ivertex = mp_impl.getPathStart(ipath), iend = mp_impl
  				.getPathEnd(ipath); ivertex < iend; ivertex++) {
  			int vertex = insertVertex_(path, -1, null);
  			if (b_some_segments) {
  				int vindex = getVertexIndex(vertex);
  				if ((mp_impl.getSegmentFlags(ivertex) & SegmentFlags.enumLineSeg) != 0) {
  					setSegmentToIndex_(vindex, null);
  				} else {
  					SegmentBuffer seg_buffer = new SegmentBuffer();
  					mp_impl.getSegment(ivertex, seg_buffer, true);
  					setSegmentToIndex_(vindex, seg_buffer.get());
  				}
  			}
  		}
  
  		return newgeom;
  	}
docs: Adds a path