📄 mitab_capi.cpp
字号:
/************************************************************************//** * Fetch a TABFC_Text object's spacing property. * * @param feature the mitab_feature object. * @return the text spacing, one of TABTS_1 (0), TABTS_1_5 (1), or TABTS_2 (2). */int MITAB_STDCALLmitab_c_get_text_spacing( mitab_feature feature ) { TABText *poFeature = (TABText *) feature; if( poFeature->GetFeatureClass() == TABFC_Text ) { return poFeature->GetTextSpacing(); } return 0;}/************************************************************************//* mitab_c_get_text_linetype() *//************************************************************************//** * Fetch a TABFC_Text object's linetype property. * * @param feature the mitab_feature object. * @return the text linetype, one of TABTL_NoLine (0), TABTL_Simple (1), or * TABTL_Arrow (2). */int MITAB_STDCALLmitab_c_get_text_linetype( mitab_feature feature ) { TABText *poFeature = (TABText *) feature; if( poFeature->GetFeatureClass() == TABFC_Text ) { return poFeature->GetTextLineType(); } return 0;}/************************************************************************//* mitab_c_set_font() *//************************************************************************//** * Set the font name in a a TABFC_Text or TABFC_FontPoint object, or set the * symbol name in a TABFC_CustomPoint. * * @param feature the mitab_feature object. * @param fontname the new font name. */void MITAB_STDCALLmitab_c_set_font( mitab_feature feature, const char * fontname ){ TABFeature *poFeature = (TABFeature *)feature; ITABFeatureFont *poFontFeature = NULL; if( poFeature->GetFeatureClass() == TABFC_Text ) { poFontFeature = (TABText *) poFeature; } else if ( poFeature->GetFeatureClass() == TABFC_FontPoint ) { poFontFeature = (TABFontPoint *) poFeature; } else if ( poFeature->GetFeatureClass() == TABFC_CustomPoint ) { poFontFeature = (TABCustomPoint *) poFeature; } if (poFontFeature) poFontFeature->SetFontName( fontname );}/************************************************************************//* mitab_c_get_font() *//************************************************************************//** * Get the font name from a TABFC_Text or TABFC_FontPoint object, or the * symbol name from a TABFC_CustomPoint. * * @param feature the mitab_feature object. * @return the text font name. */const char * MITAB_STDCALLmitab_c_get_font( mitab_feature feature ){ TABFeature *poFeature = (TABFeature *)feature; ITABFeatureFont *poFontFeature = NULL; if( poFeature->GetFeatureClass() == TABFC_Text ) { poFontFeature = (TABText *) poFeature; } else if ( poFeature->GetFeatureClass() == TABFC_FontPoint ) { poFontFeature = (TABFontPoint *) poFeature; } else if ( poFeature->GetFeatureClass() == TABFC_CustomPoint ) { poFontFeature = (TABCustomPoint *) poFeature; } if (poFontFeature) return poFontFeature->GetFontNameRef(); return "";}/************************************************************************//* mitab_c_get_font_vb() *//************************************************************************//** * Get the font name from a TABFC_Text or TABFC_FontPoint object, or the * symbol name from a TABFC_CustomPoint. (VB Version) * * @param feature the mitab_feature object. * @param font string buffer to return the text font name. * @param l the maximum lentgh of the text string including terminating null. * @return the length of the text font name. */int MITAB_STDCALL mitab_c_get_font_vb( mitab_feature feature, char * font, int l ){ TABFeature *poFeature = (TABFeature *)feature; ITABFeatureFont *poFontFeature = NULL; if( poFeature->GetFeatureClass() == TABFC_Text ) { poFontFeature = (TABText *) poFeature; } else if ( poFeature->GetFeatureClass() == TABFC_FontPoint ) { poFontFeature = (TABFontPoint *) poFeature; } else if ( poFeature->GetFeatureClass() == TABFC_CustomPoint ) { poFontFeature = (TABCustomPoint *) poFeature; } if( poFontFeature ) { strncpy(font, poFontFeature->GetFontNameRef(), l); return strlen(font); } return 0;}/************************************************************************//* mitab_c_set_brush() *//************************************************************************//** * Set an object's brush properties. Applies to region, ellipse and * rectangle objects. * * See the MIF specs for more details on the meaning and valid values of * each parameter. * * @param feature the mitab_feature object. * @param fg_color the foreground color (24 bits RGB value). * @param bg_color the background color. * @param pattern the brush number (1 is none, 2 is solid fill, etc.). * @param transparent either 0 for an opaque brush (using bg color) or 1 for * transparent (ignore bg color). */void MITAB_STDCALLmitab_c_set_brush( mitab_feature feature, int fg_color, int bg_color, int pattern, int transparent ){ TABRegion *poFeature = (TABRegion *) feature; if( poFeature->GetFeatureClass() == TABFC_Region || poFeature->GetFeatureClass() == TABFC_Ellipse || poFeature->GetFeatureClass() == TABFC_Rectangle ) { poFeature->SetBrushFGColor( fg_color ); poFeature->SetBrushBGColor( bg_color ); poFeature->SetBrushPattern( pattern ); poFeature->SetBrushTransparent( transparent ); }}/************************************************************************//* mitab_c_get_brush_fgcolor() *//************************************************************************//** * Get an object's brush foreground color property. Applies to region, * ellipse and rectangle objects. * * @param feature the mitab_feature object. * @return the brush foreground color (24 bits RGB value). */int MITAB_STDCALLmitab_c_get_brush_fgcolor( mitab_feature feature ) { TABRegion *poFeature = (TABRegion *) feature; if( poFeature->GetFeatureClass() == TABFC_Region || poFeature->GetFeatureClass() == TABFC_Ellipse || poFeature->GetFeatureClass() == TABFC_Rectangle ) { return poFeature->GetBrushFGColor(); } return 0x000000;}/************************************************************************//* mitab_c_get_brush_bgcolor() *//************************************************************************//** * Get an object's brush background color property. Applies to region, * ellipse and rectangle objects. * * @param feature the mitab_feature object. * @return the brush background color (24 bits RGB value). */int MITAB_STDCALLmitab_c_get_brush_bgcolor( mitab_feature feature ) { TABRegion *poFeature = (TABRegion *) feature; if( poFeature->GetFeatureClass() == TABFC_Region || poFeature->GetFeatureClass() == TABFC_Ellipse || poFeature->GetFeatureClass() == TABFC_Rectangle ) { return poFeature->GetBrushBGColor(); } return 0x000000;}/************************************************************************//* mitab_c_get_brush_pattern() *//************************************************************************//** * Get an object's brush pattern property. Applies to region, * ellipse and rectangle objects. * * @param feature the mitab_feature object. * @return the brush pattern number (1 is none, 2 is solid fill, etc.). */int MITAB_STDCALLmitab_c_get_brush_pattern( mitab_feature feature ) { 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_STDCALLmitab_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_STDCALLmitab_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_wyl( pattern ); poPen->SetPenColor_wyl( 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_STDCALLmitab_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 )
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -