⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mitab_capi.cpp

📁 在linux环境下
💻 CPP
📖 第 1 页 / 共 5 页
字号:
            CPLAssert( part == numRingsTotal );            poPolygon->addRingDirectly( poRing );        }        else        {            CPLAssert( part <= 0 );                        if( poFeature->GetGeometryRef() != NULL )                poMultiPolygon = (OGRMultiPolygon *) poFeature->GetGeometryRef();            else                poMultiPolygon = new OGRMultiPolygon;            poPolygon = new OGRPolygon;            poPolygon->addRingDirectly( poRing );            poMultiPolygon->addGeometryDirectly( poPolygon );            if( poFeature->GetGeometryRef() == NULL )                poFeature->SetGeometryDirectly( poMultiPolygon );        }    }    else if( poFeature->GetFeatureClass() == TABFC_Rectangle )    {        if ( poFeature->GetGeometryRef() == NULL && part == 0 )        {            // Rectangle: The MBR of the first part defines the rectangle             // corners            OGRPolygon      *poPoly = new OGRPolygon;            OGRLinearRing   *poRing = new OGRLinearRing;            poRing->setPoints( vertex_count, x, y );            poPoly->addRingDirectly( poRing );            poFeature->SetGeometryDirectly( poPoly );        }    }    else if( poFeature->GetFeatureClass() == TABFC_MultiPoint )    {        OGRPoint        *poPoint;        OGRMultiPoint   *poMultiPoint;        int i;        if( poFeature->GetGeometryRef() != NULL )            poMultiPoint = (OGRMultiPoint *) poFeature->GetGeometryRef();        else            poMultiPoint = new OGRMultiPoint;        for(i=0; i<vertex_count; i++)        {            poPoint =  new OGRPoint( x[i], y[i] );            poMultiPoint->addGeometryDirectly( poPoint );        }        poFeature->SetGeometryDirectly( poMultiPoint );    }}/************************************************************************//*                         mitab_c_set_points()                         *//************************************************************************//**  * Set an arc or ellipse feature parameters. * * @param feature the mitab_feature object. * @param center_x the arc/ellipse center X coordinate. * @param center_y the arc/ellipse center Y coordinate. * @param x_radius the arc/ellipse X radius. * @param y_radius the arc/ellipse Y radius. * @param start_angle for an arc: the start angle in degrees, counterclockwise. *                    for an ellipse, this parameter is ignored. * @param end_angle for an arc: the end angle in degrees, counterclockwise. *                  for an ellipse, this parameter is ignored. */void MITAB_STDCALLmitab_c_set_arc( mitab_feature feature,                  double center_x, double center_y,                 double x_radius, double y_radius,                 double start_angle, double end_angle){    TABFeature  *poFeature = (TABFeature *) feature;    if( poFeature->GetFeatureClass() == TABFC_Arc )    {        TABArc *poArc = (TABArc *)poFeature;        poArc->m_dCenterX = center_x;        poArc->m_dCenterY = center_y;        poArc->m_dXRadius = x_radius;        poArc->m_dYRadius = y_radius;        poArc->SetStartAngle(start_angle);        poArc->SetEndAngle(end_angle);        // We also need a point geometry to make things legal.        OGRPoint      oPoint( center_x, center_y );        poArc->SetGeometry( &oPoint );    }    else if (poFeature->GetFeatureClass() == TABFC_Ellipse)    {        TABEllipse *poEllipse = (TABEllipse *)poFeature;        poEllipse->m_dCenterX = center_x;        poEllipse->m_dCenterY = center_y;        poEllipse->m_dXRadius = x_radius;        poEllipse->m_dYRadius = y_radius;        // TABEllipse expects a polygon geometry... just use the MBR        OGRPolygon      *poPoly = new OGRPolygon;        OGRLinearRing   *poRing = new OGRLinearRing;        poRing->setNumPoints(5);        poRing->setPoint(0, center_x-x_radius, center_y-y_radius );        poRing->setPoint(1, center_x-x_radius, center_y+y_radius );        poRing->setPoint(2, center_x+x_radius, center_y+y_radius );        poRing->setPoint(3, center_x+x_radius, center_y-y_radius );        poRing->setPoint(4, center_x-x_radius, center_y-y_radius );        poPoly->addRingDirectly( poRing );        poEllipse->SetGeometryDirectly( poPoly );    }}/************************************************************************//*                          mitab_c_set_text()                          *//************************************************************************//** * Set the text string on a TABFC_Text object. * * @param feature the mitab_feature object. * @param text the text string to set in the object. */void MITAB_STDCALLmitab_c_set_text( mitab_feature feature, const char * text ){    TABText     *poFeature = (TABText *) feature;    if( poFeature->GetFeatureClass() == TABFC_Text )        poFeature->SetTextString( text );}/************************************************************************//*                          mitab_c_get_text()                          *//************************************************************************//** * Get the text string on a TABFC_Text object. * * @param feature the mitab_feature object. * @return the text string in the object. */const char * MITAB_STDCALLmitab_c_get_text( mitab_feature feature ){    TABText     *poFeature = (TABText *) feature;    if( poFeature->GetFeatureClass() == TABFC_Text )        return poFeature->GetTextString( );    return "";}/************************************************************************//*                          mitab_c_get_text_vb()                       *//************************************************************************//** * Get the text string on a TABFC_Text object (VB Version). * * @param feature the mitab_feature object. * @param text string buffer to return the text string in the object. * @param l the maximum length of the text string including terminating null. * @return the length of the text string in the object. */int MITAB_STDCALL mitab_c_get_text_vb( mitab_feature feature, char * text, int l ){    TABText     *poFeature = (TABText *) feature;    if( poFeature->GetFeatureClass() == TABFC_Text )    {        strncpy (text,poFeature->GetTextString( ),l);       return strlen(text);    }    return 0;}/************************************************************************//*                          mitab_c_set_text_display()                  *//************************************************************************//** * Set a TABFC_Text object's display properties. * * See the MIF specs for more details on the meaning and valid values of * each parameter. * * @param feature the mitab_feature object. * @param angle the text angle in degrees. * @param height the height of the text's MBR in ground units. * @param width the width of the text's MBR in ground units. * @param fg_color foreground color (24 bits RGB value). * @param bg_color background color. * @param justification one of TABTJ_Left (0), TABTJ_Center (1), or  *        TABTJ_Right (2). * @param spacing one of TABTS_1 (0), TABTS_1_5 (1), or TABTS_2 (2) * @param linetype one of TABTL_NoLine (0), TABTL_Simple (1), or  *        TABTL_Arrow (2). */void MITAB_STDCALLmitab_c_set_text_display( mitab_feature feature,                          double angle, double height, double width,                          int fg_color, int bg_color,                          int justification, int spacing, int linetype )    {    TABText     *poFeature = (TABText *) feature;    if( poFeature->GetFeatureClass() == TABFC_Text )    {        poFeature->SetTextAngle( angle );        if( height > 0 )            poFeature->SetTextBoxHeight( height );        if( width > 0 )            poFeature->SetTextBoxWidth( width );        if( fg_color != -1 )            poFeature->SetFontFGColor( fg_color );        if( bg_color != -1 )            poFeature->SetFontBGColor( bg_color );        if( justification != -1 )            poFeature->SetTextJustification( (TABTextJust) justification );        if( spacing != -1 )            poFeature->SetTextSpacing( (TABTextSpacing) justification );        if( linetype != -1 )            poFeature->SetTextLineType( (TABTextLineType) linetype );    }}/************************************************************************//*                       mitab_c_get_text_angle()                       *//************************************************************************//** * Fetch a TABFC_Text object's angle property. * * @param feature the mitab_feature object. * @return the text angle in degrees. */double MITAB_STDCALLmitab_c_get_text_angle( mitab_feature feature )    {    TABText     *poFeature = (TABText *) feature;    if( poFeature->GetFeatureClass() == TABFC_Text )    {        return poFeature->GetTextAngle();    }    return 0.0;}/************************************************************************//*                       mitab_c_get_text_height()                       *//************************************************************************//** * Fetch a TABFC_Text object's MBR height property. * * @param feature the mitab_feature object. * @return  the height of the text's MBR in ground units. */double MITAB_STDCALLmitab_c_get_text_height( mitab_feature feature )    {    TABText     *poFeature = (TABText *) feature;    if( poFeature->GetFeatureClass() == TABFC_Text )    {        return poFeature->GetTextBoxHeight();    }    return 0.0;}/************************************************************************//*                       mitab_c_get_text_width()                       *//************************************************************************//** * Fetch a TABFC_Text object's MBR width property. * * @param feature the mitab_feature object. * @return  the width of the text's MBR in ground units. */double MITAB_STDCALLmitab_c_get_text_width( mitab_feature feature )    {    TABText     *poFeature = (TABText *) feature;    if( poFeature->GetFeatureClass() == TABFC_Text )    {        return poFeature->GetTextBoxWidth();    }    return 0.0;}/************************************************************************//*                      mitab_c_get_text_fgcolor()                      *//************************************************************************//** * Fetch a TABFC_Text object's foreground color property. * * @param feature the mitab_feature object. * @return the text foreground color (24 bits RGB value). */int MITAB_STDCALLmitab_c_get_text_fgcolor( mitab_feature feature )    {    TABText     *poFeature = (TABText *) feature;    if( poFeature->GetFeatureClass() == TABFC_Text )    {        return poFeature->GetFontFGColor();    }    return 0x000000;}/************************************************************************//*                      mitab_c_get_text_bgcolor()                      *//************************************************************************//** * Fetch a TABFC_Text object's background color property. * * @param feature the mitab_feature object. * @return the text background color (24 bits RGB value). */int MITAB_STDCALLmitab_c_get_text_bgcolor( mitab_feature feature )    {    TABText     *poFeature = (TABText *) feature;    if( poFeature->GetFeatureClass() == TABFC_Text )    {        return poFeature->GetFontBGColor();    }    return 0x000000;}/************************************************************************//*                   mitab_c_get_text_justification()                   *//************************************************************************//** * Fetch a TABFC_Text object's justification property. * * @param feature the mitab_feature object. * @return the text justification, one of TABTJ_Left (0), TABTJ_Center (1), or  *        TABTJ_Right (2). */int MITAB_STDCALLmitab_c_get_text_justification( mitab_feature feature )    {    TABText     *poFeature = (TABText *) feature;    if( poFeature->GetFeatureClass() == TABFC_Text )    {        return poFeature->GetTextJustification();    }    return 0;}/************************************************************************//*                      mitab_c_get_text_spacing()                      */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -