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

📄 mitab_capi.cpp

📁 mitab,读取MapInfo的地图文件
💻 CPP
📖 第 1 页 / 共 5 页
字号:
{
    TABRegion   *poFeature = (TABRegion *) feature;

    if( poFeature->GetFeatureClass() == TABFC_Region ||
        poFeature->GetFeatureClass() == TABFC_Ellipse ||
        poFeature->GetFeatureClass() == TABFC_Rectangle )
    {
        return poFeature->GetBrushPattern();
    }
    return 1;
}

/************************************************************************/
/*                   mitab_c_get_brush_transparent()                    */
/************************************************************************/

/**
 * Get an object's brush transparency property.  Applies to region, 
 * ellipse and rectangle objects.
 *
 * @param feature the mitab_feature object.
 * @return the brush transparency value, either 0 for an opaque brush 
 *        (using bg color) or 1 for transparent (ignore bg color).
 */

int MITAB_STDCALL
mitab_c_get_brush_transparent( mitab_feature feature )
    
{
    TABRegion   *poFeature = (TABRegion *) feature;

    if( poFeature->GetFeatureClass() == TABFC_Region ||
        poFeature->GetFeatureClass() == TABFC_Ellipse ||
        poFeature->GetFeatureClass() == TABFC_Rectangle )
    {
        return poFeature->GetBrushTransparent();
    }
    return 0;
}



/************************************************************************/
/*                          mitab_c_set_pen()                           */
/************************************************************************/

/**
 * Set an object's pen properties.  Applies only to polyline, region, 
 * rectangle, arc and ellipse objects.
 *
 * See the MIF specs for more details on the meaning and valid values of
 * each parameter.
 *
 * @param feature the mitab_feature object.
 * @param width the pen width as defined in the MIF specs:  1-7 for pixel 
 *        width, or 11-2047 for width in points (10 + (point_width*10))
 * @param pattern the pen number (2 is default solid pen).
 * @param color the pen color (24 bits RGB value).
 */

void MITAB_STDCALL
mitab_c_set_pen( mitab_feature feature,
                 int width, int pattern, int color )

{
    TABFeature          *poFeature = (TABFeature *) feature;
    ITABFeaturePen      *poPen = NULL;

    if( poFeature->GetFeatureClass() == TABFC_Polyline )
        poPen = ((TABPolyline *) poFeature);
    
    if( poFeature->GetFeatureClass() == TABFC_Region )
        poPen = ((TABRegion *) poFeature);

    if( poFeature->GetFeatureClass() == TABFC_Rectangle )
        poPen = ((TABRectangle *) poFeature);

    if( poFeature->GetFeatureClass() == TABFC_Arc )
        poPen = ((TABArc *) poFeature);

    if( poFeature->GetFeatureClass() == TABFC_Ellipse )
        poPen = ((TABEllipse *) poFeature);

    if( poFeature->GetFeatureClass() == TABFC_Text )
        poPen = ((TABText *) poFeature);

    if( poPen != NULL )
    {
        poPen->SetPenWidthMIF( width );
        poPen->SetPenPattern( pattern );
        poPen->SetPenColor( color );
    }
}

/************************************************************************/
/*                       mitab_c_get_pen_color()                        */
/************************************************************************/

/**
 * Get an object's pen color property.  Applies only to polyline, region, 
 * rectangle, arc and ellipse objects.
 *
 * @param feature the mitab_feature object.
 * @return the pen color (24 bits RGB value).
 */

int MITAB_STDCALL
mitab_c_get_pen_color( mitab_feature feature )
    
{
    TABFeature          *poFeature = (TABFeature *) feature;
    ITABFeaturePen      *poPen = NULL;

    if( poFeature->GetFeatureClass() == TABFC_Polyline )
        poPen = ((TABPolyline *) poFeature);
    
    if( poFeature->GetFeatureClass() == TABFC_Region )
        poPen = ((TABRegion *) poFeature);

    if( poFeature->GetFeatureClass() == TABFC_Rectangle )
        poPen = ((TABRectangle *) poFeature);

    if( poFeature->GetFeatureClass() == TABFC_Arc )
        poPen = ((TABArc *) poFeature);

    if( poFeature->GetFeatureClass() == TABFC_Ellipse )
        poPen = ((TABEllipse *) poFeature);

    if( poFeature->GetFeatureClass() == TABFC_Text )
        poPen = ((TABText *) poFeature);

    if( poPen != NULL )
    {
        return poPen->GetPenColor();
    }

    return 0x000000;
}

/************************************************************************/
/*                       mitab_c_get_pen_width()                        */
/************************************************************************/

/**
 * Get an object's pen width property.  Applies only to polyline, region, 
 * rectangle, arc and ellipse objects.
 *
 * @param feature the mitab_feature object.
 * @return the pen as defined in the MIF specs:  1-7 for pixel 
 *        width, or 11-2047 for width in points (10 + (point_width*10)).
 */

int MITAB_STDCALL
mitab_c_get_pen_width( mitab_feature feature )
    
{
    TABFeature          *poFeature = (TABFeature *) feature;
    ITABFeaturePen      *poPen = NULL;

    if( poFeature->GetFeatureClass() == TABFC_Polyline )
        poPen = ((TABPolyline *) poFeature);
    
    if( poFeature->GetFeatureClass() == TABFC_Region )
        poPen = ((TABRegion *) poFeature);

    if( poFeature->GetFeatureClass() == TABFC_Rectangle )
        poPen = ((TABRectangle *) poFeature);

    if( poFeature->GetFeatureClass() == TABFC_Arc )
        poPen = ((TABArc *) poFeature);

    if( poFeature->GetFeatureClass() == TABFC_Ellipse )
        poPen = ((TABEllipse *) poFeature);

    if( poFeature->GetFeatureClass() == TABFC_Text )
        poPen = ((TABText *) poFeature);

    if( poPen != NULL )
    {
        return poPen->GetPenWidthMIF();
    }

    return 0;
}

/************************************************************************/
/*                      mitab_c_get_pen_pattern()                       */
/************************************************************************/

/**
 * Get an object's pen pattern property.  Applies only to polyline, region, 
 * rectangle, arc and ellipse objects.
 *
 * @param feature the mitab_feature object.
 * @return the pen pattern number (2 is default solid pen).
 */

int MITAB_STDCALL
mitab_c_get_pen_pattern( mitab_feature feature )
    
{
    TABFeature          *poFeature = (TABFeature *) feature;
    ITABFeaturePen      *poPen = NULL;

    if( poFeature->GetFeatureClass() == TABFC_Polyline )
        poPen = ((TABPolyline *) poFeature);
    
    if( poFeature->GetFeatureClass() == TABFC_Region )
        poPen = ((TABRegion *) poFeature);

    if( poFeature->GetFeatureClass() == TABFC_Rectangle )
        poPen = ((TABRectangle *) poFeature);

    if( poFeature->GetFeatureClass() == TABFC_Arc )
        poPen = ((TABArc *) poFeature);

    if( poFeature->GetFeatureClass() == TABFC_Ellipse )
        poPen = ((TABEllipse *) poFeature);

    if( poFeature->GetFeatureClass() == TABFC_Text )
        poPen = ((TABText *) poFeature);

    if( poPen != NULL )
    {
        return poPen->GetPenPattern();
    }

    return 0x000000;
}


/************************************************************************/
/*                         mitab_c_set_symbol()                         */
/************************************************************************/

/**
 * Set an object's symbol properties.  Applies only to point objects and
 * multipoint.
 *
 * See the MIF specs for more details on the meaning and valid values of
 * each parameter.
 *
 * @param feature the mitab_feature object.
 * @param symbol_no the symbol number (valid range: 32 to 67)
 * @param symbol_size the symbol size in pixels (valid range 1 to 48)
 * @param symbol_color the symbol color (24 bits RGB value)
 */

void MITAB_STDCALL
mitab_c_set_symbol( mitab_feature feature, int symbol_no,
                    int symbol_size, int symbol_color )

{
    TABPoint    *poFeature = (TABPoint *) feature;

    if(( poFeature->GetFeatureClass() == TABFC_Point ) ||
       ( poFeature->GetFeatureClass() == TABFC_FontPoint ) ||
       ( poFeature->GetFeatureClass() == TABFC_CustomPoint ) ||
       ( poFeature->GetFeatureClass() == TABFC_MultiPoint ))
    {
        poFeature->SetSymbolNo( symbol_no );
        poFeature->SetSymbolSize( symbol_size );
        poFeature->SetSymbolColor( symbol_color );
    }
}                                                               

/************************************************************************/
/*                         mitab_c_set_symbol_angle()                   */
/************************************************************************/

/**
 * Set the point symbol's angle. Applies only to point objects of type
 * TABFC_FontPoint.
 *
 * @param feature the mitab_feature object.
 * @param symbol_angle the symbol angle in degrees
 */

void MITAB_STDCALL
mitab_c_set_symbol_angle( mitab_feature feature, double symbol_angle )

{
    TABFontPoint    *poFeature = (TABFontPoint *) feature;

    if( poFeature->GetFeatureClass() == TABFC_FontPoint )
    {
        poFeature->SetSymbolAngle( symbol_angle );
    }
}                                                               

/************************************************************************/
/*                     mitab_c_get_symbol_color()                       */
/************************************************************************/

/**
 * Get an object's symbol color property.  Applies only to point and 
 * multipoint objects.
 *
 * @param feature the mitab_feature object.
 * @return the symbol color (24 bits RGB value).
 */

int MITAB_STDCALL
mitab_c_get_symbol_color( mitab_feature feature )
    
{
    TABPoint    *poFeature = (TABPoint *) feature;

    if(( poFeature->GetFeatureClass() == TABFC_Point ) ||
       ( poFeature->GetFeatureClass() == TABFC_MultiPoint ))
    {
        return poFeature->GetSymbolColor();
    }
    return 0x000000;
}

/************************************************************************/
/*                       mitab_c_get_symbol_no()                        */
/************************************************************************/

/**
 * Get an object's symbol number property.  Applies only to point and 
 * multipoint objects.
 *
 * @param feature the mitab_feature object.
 * @return the symbol number (valid range: 32 to 67)
 */

int MITAB_STDCALL
mitab_c_get_symbol_no( mitab_feature feature )
    
{
    TABPoint    *poFeature = (TABPoint *) feature;

    if(( poFeature->GetFeatureClass() == TABFC_Point ) ||
       ( poFeature->GetFeatureClass() == TABFC_MultiPoint ))
    {
        return poFeature->GetSymbolNo();
    }
    return 0;
}

/************************************************************************/
/*                     mitab_c_get_symbol_size()                        */
/************************************************************************/

/**
 * Get an object's symbol size property.  Applies only to point and 
 * multipoint objects.
 *
 * @param feature the mitab_feature object.
 * @return the symbol size in pixels (valid range 1 to 48)
 */

int MITAB_STDCALL
mitab_c_get_symbol_size( mitab_feature feature )
    
{
    TABPoint    *poFeature = (TABPoint *) feature;

    if(( poFeature->GetFeatureClass() == TABFC_Point ) ||
       ( poFeature->GetFeatureClass() == TABFC_MultiPoint ))
    {
        return poFeature->GetSymbolSize();
    }
    return 1;
}

/************************************************************************/
/*                     mitab_c_get_symbol_angle()                       */
/************************************************************************/

/**
 * Get an font point object's angle property.  Applies only to point objects
 * of type TABFC_FontPoint
 *
 * @param feature the mitab_feature object.
 * @return the symbol angle in degrees
 */

double MITAB_STDCALL
mitab_c_get_sy

⌨️ 快捷键说明

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