void
ArxDbgUtils::collectVertices(const AcDb3dPolyline* pline, AcGePoint3dArray& pts)
{
    ASSERT(pline != NULL);
    ASSERT(pts.isEmpty());

    AcDbObjectIterator* vertexIter = pline->vertexIterator();
    ASSERT(vertexIter != NULL);
    if (vertexIter == NULL)
        return;

    AcDb3dPolylineVertex* vertex;
    for (; !vertexIter->done(); vertexIter->step()) {
        if (acdbOpenObject(vertex, vertexIter->objectId(), AcDb::kForRead) == Acad::eOk) {
            if (vertex->vertexType() != AcDb::k3dControlVertex)
                pts.append(vertex->position());
            vertex->close();
        }
    }
    delete vertexIter;

    ASSERT(pts.isEmpty() == false);

    if (pline->isClosed()) {
        AcGePoint3d tmpPt = pts[0];        // used to be a bug in dynamic arrays (not sure if its still there??)
        pts.append(tmpPt);
    }
}
Beispiel #2
0
static void FindPolygonLinePos( const AcDbVoidPtrArray& lines,
                                const AcGePoint3dArray& polygons,
                                const AcDbIntArray& polygon_counts,
                                int k,
                                AcDbIntArray& linePos )
{
    int s = 0;
    for( int i = 0; i < k; i++ )
    {
        s += polygon_counts[i];
    }
    int t = s + polygon_counts[k];

    AcGePoint3dArray polygon;
    for( int i = s; i < t; i++ )
    {
        polygon.append( polygons[i] );
    }

    int n = polygon.length();
    for( int i = 0; i < n; i++ )
    {
        linePos.append( FindLineByPoints( lines, polygon[i], polygon[( i + 1 ) % n] ) );
    }
}
Beispiel #3
0
static void DividArc( const AcGePoint3d& spt, const AcGePoint3d& ept, const AcGePoint3d& thirdPt,
					 int count, AcGePoint3dArray& pts )
{
	pts.append( spt );

	AcGeCircArc3d arc( spt, thirdPt, ept );
	AcGePoint3d cnt = arc.center();
	//	double radius = arc.radius();
	AcGeVector3d v1 = spt - cnt;
	AcGeVector3d v2 = ept - cnt;
	int c = ( arc.normal().z > 0 ? 1 : -1 ); // 弧线方向

	double a1 = v1.angleTo( AcGeVector3d::kXAxis, -AcGeVector3d::kZAxis );
	double a2 = v2.angleTo( AcGeVector3d::kXAxis, -AcGeVector3d::kZAxis );

	double dq = abs( a2 - a1 ) / count;
	//acutPrintf(_T("\na1:%.3f, a2:%.3f dq:%.3f c:%d"), a1, a2, dq, c);
	for( int i = 1; i < count; i++ )
	{
		v1.rotateBy( c * dq, AcGeVector3d::kZAxis );
		pts.append( cnt + v1 );
		//acutPrintf(_T("\n点%d:(%d,%d)"),i,pts[i].x,pts[i].y);
	}
	pts.append( ept );
}
Beispiel #4
0
static void AppendNewGoafPolygon( const AcGePoint3dArray& polygons,
                                  const AcDbIntArray& polygon_counts,
                                  const AcDbIntArray& colinearEdges,
                                  const AcDbIntArray& parTypes,
                                  const AcGePoint3dArray& ex_spts,
                                  const AcGePoint3dArray& ex_epts,
                                  const AcGeDoubleArray& ex_dirs,
                                  const AcDbIntArray& linePos,
                                  int k,
                                  AcGePoint3dArray& spts,
                                  AcGePoint3dArray& epts,
                                  AcGeDoubleArray& dirs,
                                  AcDbIntArray& gas_types,
                                  AcDbIntArray& gas_linePos )
{
    int s = 0;
    for( int i = 0; i < k; i++ )
    {
        s += polygon_counts[i];
    }
    int t = s + polygon_counts[k];

    for( int i = s; i < t; i++ )
    {
        if( colinearEdges[i] == 0 )
        {
            spts.append( ex_spts[i] );
            epts.append( ex_epts[i] );
            dirs.append( ex_dirs );
            gas_types.append( parTypes[i] );
            gas_linePos.append( linePos[i] );
        }
    }
}
Beispiel #5
0
static void ExplodeGoafPolygon( const AcGePoint3dArray& polygon,
                                const AcGePoint3dArray& inner_polygon,
                                const AcGePoint3dArray& outer_polygon,
                                AcGePoint3dArray& spts, AcGePoint3dArray& epts )
{
    int n = polygon.length();
    for( int i = 0; i < n; i++ )
    {
        AcGePoint3d spt = polygon[i], ept = polygon[( i + 1 ) % n];

        // 如果向外扩展的坐标没有发生变化
        // 则使向内扩展坐标
        if( spt == outer_polygon[2 * i] || ept == outer_polygon[2 * i + 1] )
        {
            spt = inner_polygon[i];
            ept = inner_polygon[( i + 1 ) % n];
        }
        else
        {
            spt = outer_polygon[2 * i];
            ept = outer_polygon[2 * i + 1];
        }

        spts.append( spt );
        epts.append( ept );
    }
}
Beispiel #6
0
static void AdjustObturationPointSource( const AcGePoint3dArray& polygon, const AcGePoint3dArray& ext_polygon, AcGePoint3dArray& ob_pts )
{
    bool isClockWise = ( ClockWise( polygon ) == -1 );

    int n = ob_pts.length();
    int m = polygon.length();
    for( int i = 0; i < n; i++ )
    {
        int pos = FindPointOnPolygon( ob_pts[i], polygon );
        //acutPrintf(_T("\n点源位置:%d"), pos);
        if( pos != -1 )
        {
            int p1 = ( ( pos == 0 ) ? m - 1 : pos - 1 );
            int p2 = pos;
            int p3 = ( ( pos == m - 1 ) ? 0 : pos + 1 );
            ob_pts[i] = ProjectPointOfTwoLine(
                            polygon[p2],
                            polygon[p3],
                            ext_polygon[p2],
                            ext_polygon[p3],
                            ob_pts[i] );

            // 进行将点源坐标向采空区做微小的调整
            ob_pts[i] = MinorAjustPointSource(
                            isClockWise,
                            polygon[p1],  // 前一个点
                            polygon[p2],            // 当前点
                            polygon[p3],      // 下一个点
                            ob_pts[i] );
        }
    }
}
void
ArxDbgUtils::collectVertices(const AcDb2dPolyline* pline, AcGePoint3dArray& pts,
            AcGeDoubleArray& bulges, bool asWcsPts)
{
    ASSERT(pline != NULL);
    ASSERT(pts.isEmpty() && bulges.isEmpty());

    AcDbObjectIterator* vertexIter = pline->vertexIterator();
    ASSERT(vertexIter != NULL);
    if (vertexIter == NULL)
        return;

    AcDb2dVertex* vertex;
    for (; !vertexIter->done(); vertexIter->step()) {
        if (acdbOpenObject(vertex, vertexIter->objectId(), AcDb::kForRead) == Acad::eOk) {
            if (vertex->vertexType() != AcDb::k2dSplineCtlVertex) {
                if (asWcsPts)
                    pts.append(pline->vertexPosition(*vertex));        // returns WCS
                else
                    pts.append(vertex->position());                    // returns ECS
                bulges.append(vertex->bulge());
            }
            vertex->close();
        }
    }
    delete vertexIter;

    ASSERT(pts.isEmpty() == Adesk::kFalse);

    if (pline->isClosed()) {
        AcGePoint3d tmpPt = pts[0];        // used to be a bug in dynamic arrays (not sure if its still there??)
        pts.append(tmpPt);
        bulges.append(0.0);
    }
}
//- Osnap points protocol
Acad::ErrorStatus SingleTunnelDraw::subGetOsnapPoints (
    AcDb::OsnapMode osnapMode,
    int gsSelectionMark,
    const AcGePoint3d& pickPoint,
    const AcGePoint3d& lastPoint,
    const AcGeMatrix3d& viewXform,
    AcGePoint3dArray& snapPoints,
    AcDbIntArray& geomIds ) const
{
    assertReadEnabled () ;

    // 只捕捉1种类型的点:端点
    if( osnapMode != AcDb::kOsModeEnd )
        return Acad::eOk;

    Acad::ErrorStatus es = Acad::eOk;

    if ( osnapMode == AcDb::kOsModeEnd )
    {
        snapPoints.append( m_startPt );
        snapPoints.append( m_endPt );
    }

    return es;
}
Beispiel #9
0
void DetermineHoleGEDraw::caclBackGroundMinPolygon( AcGePoint3dArray& pts )
{
	pts.append(m_spt1);
	pts.append(m_spt2);
	pts.append(m_spt3);
	pts.append(m_spt4);
}
Beispiel #10
0
void DrawCmd::DrawChimney( void )
{
    acutPrintf( _T( "\n绘制风筒测试..." ) );

    AcDbObjectId objId = ArxUtilHelper::SelectObject( _T( "请选择一个掘进工作面:" ) );
    if( objId.isNull() ) return;
    if( !ArxUtilHelper::IsEqualType( _T( "TTunnel" ), objId ) ) return;

    AcDbObjectIdArray objIds;
    DrawHelper::GetTagGEById2( objId, _T( "Chimney" ), objIds );
    if( !objIds.isEmpty() )
    {
        AfxMessageBox( _T( "该掘进工作面已设置了风筒!" ) );
        return;
    }

    AcGePoint3dArray pts;
    PolyLineJig jig;
    if( !jig.doJig( pts ) ) return;

    int len = pts.length();
    acutPrintf( _T( "\n点个数:%d" ), len );
    if( len < 2 ) return;

    Chimney* pChimney = new Chimney();
    pChimney->setRelatedGE( objId ); // 关联的图元必须是掘进工作面

    for( int i = 0; i < len; i++ ) pChimney->addControlPoint( pts[i] );

    // 初始化并提交到数据库
    if( !ArxUtilHelper::PostToModelSpace( pChimney ) ) delete pChimney;
}
bool
ArxDbgUtils::collectVertices(const AcDbPolygonMesh* pmesh, AcGePoint3dArray& pts,
                            int& mSize, int& nSize)
{
    AcDbObjectIterator*  vertexIter = pmesh->vertexIterator();
    if (vertexIter == NULL)
        return false;

    Acad::ErrorStatus es;
    AcDbPolygonMeshVertex* pVertex;
    AcGePoint3d tmpPt;

    if (pmesh->polyMeshType() == AcDb::kSimpleMesh) {
        mSize = pmesh->mSize();
        nSize = pmesh->nSize();
    }
    else {
        mSize = pmesh->mSurfaceDensity();
        nSize = pmesh->nSurfaceDensity();
    }

    int nCount = 0;
    int totalCount = 0;
    for (; !vertexIter->done(); vertexIter->step()) {
        es = acdbOpenObject(pVertex, vertexIter->objectId(), AcDb::kForRead);
        if (es != Acad::eOk) {
            ArxDbgUtils::rxErrorMsg(es);
            delete vertexIter;
            return false;
        }
        pts.append(pVertex->position());
        nCount++;
        totalCount++;
        if (nCount == nSize) {
            if (pmesh->isNClosed()) {
                tmpPt = pts[totalCount - nSize];        // work around bug by making temp copy (not sure if still a bug??)
                pts.append(tmpPt);
                totalCount++;
            }
            nCount = 0;
        }
    }
    delete vertexIter;

    if (pmesh->isNClosed())
        nSize++;
    if (pmesh->isMClosed()) {
        mSize++;
        for (int i=0; i<nSize; i++) {
            tmpPt = pts[i];        // see note above
            pts.append(tmpPt);    
        }
    }

    return true;
}
Beispiel #12
0
Acad::ErrorStatus DoubleArcTunnelDraw::subGetGripPoints( AcGePoint3dArray& gripPoints, AcDbIntArray& osnapModes, AcDbIntArray& geomIds ) const
{
    assertReadEnabled () ;

    gripPoints.append( m_startPt );
    gripPoints.append( m_endPt );
    gripPoints.append( m_thirdPt );

    return Acad::eOk;
}
Beispiel #13
0
//- Grip points protocol
Acad::ErrorStatus SingleTunnelDraw::subGetGripPoints (
    AcGePoint3dArray& gripPoints, AcDbIntArray& osnapModes, AcDbIntArray& geomIds ) const
{
    assertReadEnabled () ;
    //----- This method is never called unless you return eNotImplemented
    //----- from the new getGripPoints() method below (which is the default implementation)

    gripPoints.append( m_startPt );
    gripPoints.append( m_endPt );
    return Acad::eOk;
}
static void DrawLinePoints( AcGiWorldDraw* mode, const AcGePoint3dArray& pts )
{
    int len = pts.length();
    for( int i = 0; i < len - 1; i++ )
    {
        AcGePoint3dArray tpts;
        tpts.append( pts[i] );
        tpts.append( pts[i + 1] );
        mode->geometry().worldLine( tpts.asArrayPtr() );
    }
}
Beispiel #15
0
// 查找采空区的其它边
void FindGasBoundary( const AcDbObjectIdArray& objIds,
                      const AcDbVoidPtrArray& lines,
                      AcGePoint3dArray& spts,
                      AcGePoint3dArray& epts,
                      AcGeDoubleArray& dirs,
                      AcDbIntArray& gas_types,
                      AcDbObjectIdArray& gas_objIds )
{
    // 查找所有的采空区
    AcDbObjectIdArray goaf_objIds;
    FindAllGoafs( goaf_objIds );

    // 将采空区多边形转换成一个1维数组
    AcGePoint3dArray polygons;
    AcDbIntArray polygon_counts;
    BuildGoafPolygonArray( goaf_objIds, polygons, polygon_counts );

    // 标记采空区分支是否与其它采空区有共线边
    AcDbIntArray colinearEdges;
    FindPolygonColinearEdges( polygons, polygon_counts, colinearEdges );

    // 查找所有的工作面
    AcDbVoidPtrArray ws_lines;
    FilterLines( lines, ws_lines, true );

    // 划分采空区多边形(工作面、两帮、开切眼)
    AcDbIntArray parTypes;
    PartitionGoafPolygons( ws_lines, polygons, polygon_counts, parTypes );

    assert( parTypes.length() == polygons.length() );

    // 工作面需要特殊处理
    AcDbIntArray gas_linePos;
    AdjustGoafPolygon(
        lines, polygons, polygon_counts,
        colinearEdges, parTypes,
        spts, epts, dirs,
        gas_types, gas_linePos );

    assert( gas_types.length() == gas_linePos.length() );

    for( int i = 0; i < gas_linePos.length(); i++ )
    {
        int pos = gas_linePos[i];
        if( pos != -1 )
        {
            gas_objIds.append( objIds[pos] );
        }
        else
        {
            gas_objIds.append( AcDbObjectId::kNull );
        }
    }
}
Beispiel #16
0
Adesk::Boolean SingleTunnelDraw::subWorldDraw( AcGiWorldDraw* mode )
{
    assertReadEnabled () ;

    AcGePoint3dArray pts;
    pts.append( m_startPt );
    pts.append( m_endPt );
    mode->geometry().worldLine( pts.asArrayPtr() );

    return Adesk::kTrue;
}
Beispiel #17
0
int CArxHelper::CreatePLine(AcDbPolyline*& pPolyline, const AcGePoint3dArray& arrPt, double dWith, BOOL bClose)
{
	pPolyline = new AcDbPolyline(arrPt.length());
	for(int i = 0; i < arrPt.length(); i++)
	{
		pPolyline->addVertexAt(i,arrPt.at(i).convert2d(AcGePlane::kXYPlane),0.0);
	}
	pPolyline->setConstantWidth(dWith);
	pPolyline->setClosed(bClose);
	return 0;
}
Beispiel #18
0
void DrawPolygon( AcGiWorldDraw* mode, const AcGePoint3dArray& polygon, bool fill )
{
    AcGiSubEntityTraits& traits = mode->subEntityTraits();

    // 是否填充
    AcGiFillType ft = traits.fillType();
    traits.setFillType( fill ? kAcGiFillAlways : kAcGiFillNever );

    mode->geometry().polygon( polygon.length(), polygon.asArrayPtr() );

    traits.setFillType( ft );
}
Beispiel #19
0
void BuildGoafPolygonArray( const AcDbObjectIdArray& objIds, AcGePoint3dArray& polygons, AcDbIntArray& polygon_counts )
{
    for( int i = 0; i < objIds.length(); i++ )
    {
        // 获取采空区的多边形
        AcGePoint3dArray polygon;
        GetGoafPolygon( objIds[i], polygon );

        polygons.append( polygon );
        polygon_counts.append( polygon.length() );
    }
}
Beispiel #20
0
void
createPolyline()
{
    // Set four vertex locations for the pline.
    //
    AcGePoint3dArray ptArr;
    ptArr.setLogicalLength(4);
    for (int i = 0; i < 4; i++) {
        ptArr[i].set((double)(i/2), (double)(i%2), 0.0);
    }

    // Dynamically allocate an AcDb2dPolyline object,
    // given four vertex elements whose locations are supplied
    // in ptArr.  The polyline has no elevation, and is
    // explicitly set as closed.  The polyline is simple;
    // that is, not curve fit or a spline.  By default, the
    // widths are all 0.0 and there are no bulge factors.
    //
    AcDb2dPolyline *pNewPline = new AcDb2dPolyline(
        AcDb::k2dSimplePoly, ptArr, 0.0, Adesk::kTrue);

    pNewPline->setColorIndex(3);

    // Get a pointer to a Block Table object.
    //
    AcDbBlockTable *pBlockTable;
    acdbHostApplicationServices()->workingDatabase()
        ->getSymbolTable(pBlockTable, AcDb::kForRead);

    // Get a pointer to the MODEL_SPACE BlockTableRecord.
    //
    AcDbBlockTableRecord *pBlockTableRecord;
    pBlockTable->getAt(ACDB_MODEL_SPACE, pBlockTableRecord,
        AcDb::kForWrite);

    pBlockTable->close();

    // Append the pline object to the database and
    // obtain its Object ID.
    //
    AcDbObjectId plineObjId;
    pBlockTableRecord->appendAcDbEntity(plineObjId,
        pNewPline);

    pBlockTableRecord->close();

    // Make the pline object reside on layer "0".
    //
    pNewPline->setLayer("0");

    pNewPline->close();
}
void
ArxDbgUtils::collectVertices(const AcDb2dPolyline* pline, AcGePoint3dArray& pts,
                        AcDbIntArray& types, AcGeDoubleArray& bulges,
                        AcGeDoubleArray& startWidths, 
                        AcGeDoubleArray& endWidths, bool& hasWidth)
{
    ASSERT(pline != NULL);
    ASSERT(pts.isEmpty() && bulges.isEmpty());

    hasWidth = false;

    AcDbObjectIterator* vertexIter = pline->vertexIterator();
    ASSERT(vertexIter != NULL);
    if (vertexIter == NULL)
        return;

    AcDb2dVertex* vertex;
    for (; !vertexIter->done(); vertexIter->step()) {
        if (acdbOpenObject(vertex, vertexIter->objectId(), AcDb::kForRead) == Acad::eOk) {
            if (vertex->vertexType() != AcDb::k2dSplineCtlVertex) {
                pts.append(pline->vertexPosition(*vertex));        // returns WCS
                bulges.append(vertex->bulge());
                startWidths.append(vertex->startWidth());
                endWidths.append(vertex->endWidth());

                if (vertex->startWidth() || vertex->endWidth())
                    hasWidth = true;
                types.append(vertex->vertexType());
            }
            vertex->close();
        }
    }
    delete vertexIter;

    ASSERT(pts.isEmpty() == false);

    if (pline->isClosed()) {
        AcGePoint3d tmpPt = pts[0];        // used to be a bug in dynamic arrays (not sure if its still there??)
        pts.append(tmpPt);

        bulges.append(0.0);

        int tmpType = types[0];
        types.append(tmpType);

        double tmpWidth = startWidths[0];
        startWidths.append(tmpWidth);

        tmpWidth = endWidths[0];
        endWidths.append(tmpWidth);
    }
}
void InteriorPointsConstructor::printFirstInteriorPoints(int color, bool flag)
{
	int i = 1;
	int j = 0;
		
		
		AcGePoint3dArray ptArr;
		ptArr.setLogicalLength(_interiorArray[i].length()+1);
		
		
		while (j < _interiorArray[i].length())
		{
			
			ptArr[j].set(_interiorArray[i][j].x, _interiorArray[i][j].y, _interiorArray[i][j].z);
			
			
		
			j++;
		}
		ptArr[j].set(_interiorArray[0][0].x, _interiorArray[0][0].y, _interiorArray[0][0].z);
			

		AcDb3dPolyline *pNewPline = new AcDb3dPolyline(AcDb::k3dSimplePoly , ptArr, Adesk::kFalse);
		
		pNewPline->setColorIndex(color);

		AcDbBlockTable *pBlockTable;
		AcDbBlockTableRecord *pBlockTableRecord;


		acdbHostApplicationServices()->workingDatabase()->getSymbolTable(pBlockTable, AcDb::kForRead);

		
		
		pBlockTable->getAt(ACDB_MODEL_SPACE, pBlockTableRecord, AcDb::kForWrite);


		AcDbObjectId plineObjId;
		pBlockTableRecord->appendAcDbEntity(plineObjId, pNewPline);
		
		pBlockTable->close();
		pBlockTableRecord->close();

		//pNewPline->setLayer(_T("0"));
		//pNewPline->setClosed(Adesk::kFalse);
		pNewPline->close();
		//}
		//delete pNewPline;
		
	
	
}
void
AsdkSmiley::eyes(AcGePoint3dArray& array) const
{
    assertReadEnabled();
    // left eye
    AcGePoint3d eye = center();
    eye[X] -= meyesapart / 2;
    eye[Y] += meyesheight;
    array.append(eye);
    // right eye
    eye[X] += meyesapart;
    array.append(eye);
} // smiley eyes
Beispiel #24
0
void TailraceGEDraw::caclBackGroundMinPolygon( AcGePoint3dArray& pts )
{
	//AcGeCircArc3d arc( m_pt2, m_pt0, m_pt3 );
	//AcGePoint3d cnt = arc.center();
	//double radius = arc.radius();

	//AcGeVector3d v = pt - cnt;
	//v.normalize();

	DividArc( m_pt2, m_pt3, m_pt0, 90, pts );
	pts.append(m_pt8);
	pts.append(m_pt5);
	pts.append(m_pt4);
}
Beispiel #25
0
void ContourColorDlg::OnBnClickedOk()
{
    UpdateData( TRUE );

    // 获取图层名称
    CString layer;
    if( !GetLayer( layer ) )
    {
        MessageBox( _T( "没有选择包含等值线的图层" ) );
        return;
    }

    AcGeDoubleArray zValues;
    AcArray<COLORREF> colors;
    int n = m_colorList.GetItemCount();
    for( int i = 0; i < n; i++ )
    {
        ColorListItemData* pData = ( ColorListItemData* )m_colorList.GetItemData( i );
        zValues.append( pData->z );
        colors.append( pData->rgb );
    }
    // 删除最后一个z值
    zValues.removeLast();

    // 删除color list上的附加数据
    DeleteColorListItemDatas();

    // 获取图层上的等值线信息图元
    AcDbObjectId objId = GetContourInfoOnLayer( layer );
    SetContourInfo( objId, zValues, colors, m_bFillColor );

    // 获取边界坐标数据
    AcGePoint3dArray bounds;
    GetBoundaryPoints( bounds );
    if( bounds.isEmpty() )
    {
        MessageBox( _T( "请添加一个闭合的井田边界" ) );
        return;
    }

    // 获取点集数据
    AcGePoint3dArray datas;
    GetContourDatas( objId, datas );

    //assert((colors.length()-zValues.length()) == 1);
    // 绘制填充
    DrawFill( layer, bounds,  datas, zValues, colors, m_bFillColor );

    OnOK();
}
Beispiel #26
0
void DrawCross( AcGiWorldDraw* mode, const AcGePoint3d& pt, double radius )
{
    AcGeVector3d v( AcGeVector3d::kXAxis );
    v *= radius;

    for( int i = 0; i < 4; i++ )
    {
        AcGePoint3dArray pts;
        pts.append( pt );
        pts.append( pt + v );
        mode->geometry().worldLine( pts.asArrayPtr() );

        v.rotateBy( PI / 2, AcGeVector3d::kZAxis );
    }
}
Acad::ErrorStatus PDSphere::getgrippoints(AcGePoint3dArray& gripArray) const
{
	assertReadEnabled();
	gripArray.append(m_ptCenter);

	gripArray.append(m_ptCenter + AcGeVector3d(1,0,0)*m_dRadius);
	gripArray.append(m_ptCenter + AcGeVector3d(0,1,0)*m_dRadius);
	gripArray.append(m_ptCenter + AcGeVector3d(0,0,1)*m_dRadius);

	gripArray.append(m_ptCenter + AcGeVector3d(-1,0,0)*m_dRadius);
	gripArray.append(m_ptCenter + AcGeVector3d(0,-1,0)*m_dRadius);
	gripArray.append(m_ptCenter + AcGeVector3d(0,0,-1)*m_dRadius);

	return Acad::eOk; 
}
Beispiel #28
0
void DrawRect( AcGiWorldDraw* mode, const AcGePoint3d& pt, double angle, double width, double height, bool fill )
{
    AcGiSubEntityTraits& traits = mode->subEntityTraits();

    AcGePoint3dArray pts;
    BuildRect( pt, angle, width, height, pts );

    // 是否填充
    AcGiFillType ft = traits.fillType();
    traits.setFillType( fill ? kAcGiFillAlways : kAcGiFillNever );

    mode->geometry().polygon( pts.length(), pts.asArrayPtr() );

    traits.setFillType( ft );
}
Beispiel #29
0
static void AdjustGoafPolygon( const AcDbVoidPtrArray& lines,
                               const AcGePoint3dArray& polygons,
                               const AcDbIntArray& polygon_counts,
                               const AcDbIntArray& colinearEdges,
                               const AcDbIntArray& parTypes,
                               AcGePoint3dArray& spts,
                               AcGePoint3dArray& epts,
                               AcGeDoubleArray& dirs,
                               AcDbIntArray& gas_types,
                               AcDbIntArray& gas_linePos )
{
    // 查找所有采空区边对应的直线
    AcDbIntArray goaf_linePos;
    FindGoafPolygonLinePos( lines, polygons, polygon_counts, goaf_linePos );

    // 分解所有的分支
    AcGePoint3dArray ex_spts, ex_epts;
    AcGeDoubleArray ex_dirs;
    AdjustAndExplodeGoafPolygons( lines, polygons, polygon_counts, ex_spts, ex_epts, ex_dirs );

    assert( ex_spts.length() == polygons.length() );

    for( int i = 0; i < polygon_counts.length(); i++ )
    {
        AppendNewGoafPolygon(
            polygons, polygon_counts,
            colinearEdges, parTypes,
            ex_spts, ex_epts, ex_dirs,
            goaf_linePos,
            i,
            spts, epts, dirs,
            gas_types,
            gas_linePos );
    }
}
Acad::ErrorStatus 
rx_scanPline(AcDb2dPolyline*        pline,
             AcGePoint3dArray&      points,
             AcGeDoubleArray&       bulges)
{
    Acad::ErrorStatus es = Acad::eOk;

    AcDb2dVertex*  vert   = NULL;
    AcDbObjectId   vId;

    AcDbObjectIterator *vIter;
    vIter = pline->vertexIterator();

    for (; !vIter->done(); vIter->step()) {
		vId = vIter->objectId();

		if ( (es =pline->openVertex(vert, vId, AcDb::kForRead)) != Acad::eOk )
			return es;

		points.append(vert->position());
		bulges.append(vert->bulge());
    }

    delete vIter;
    
    return es;
}