📄 mitab_capi.cpp
字号:
mitab_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_STDCALL
mitab_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_STDCALL
mitab_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_STDCALL
mitab_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_STDCALL
mitab_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() */
/************************************************************************/
/**
* 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_STDCALL
mitab_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_STDCALL
mitab_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_STDCALL
mitab_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_STDCALL
mitab_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_STDCALL
mitab_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_STDCALL
mitab_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_STDCALL
mitab_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_STDCALL
mitab_c_get_brush_pattern( mitab_feature feature )
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -