Archicad 28 C++ API
Loading...
Searching...
No Matches
ACAPI::v1::ZoneLabelingSettings Class Reference

A class that contains functions related to zone labeling by favorite. More...

#include <ZoneLabelingSettings.hpp>

Inheritance diagram for ACAPI::v1::ZoneLabelingSettings:
ACAPI::v1::Object

Public Member Functions

bool IsAutomaticLabelingOn () const
 A function to return if a label should automatically be placed onto new zone or not.
 
Result< GS::UniString > GetSelectedFavoriteName () const
 A function to return the selected favorite from infobox for zone.
 
template<class ModifierFunc >
Result< void > Modify (ModifierFunc &&modifierFunc)
 Executes the given modifier scope in a NotUndoable command.
 
void SetAutomaticLabeling (bool labeling)
 A function to set whether a label should automatically be placed onto new zones or not.
 
Result< void > SetSelectedFavorite (const GS::UniString &favoriteName)
 A function to set the label favorite that should be used for the automatic labeling of zones.
 
- Public Member Functions inherited from ACAPI::v1::Object
 Object (std::shared_ptr< Impl::ObjectImpl > impl)
 Constructs a new object.
 
const API_TokenGetToken () const
 Get the token for this object.
 

Friends

ZoneLabelingSettings CreateZoneLabelingSettings ()
 A function to create zone labeling settings instance, that lets you query and manipulate zone label favorite related data.
 

Additional Inherited Members

- Protected Member Functions inherited from ACAPI::v1::Object
 ~Object ()
 Default destructor.
 
- Protected Attributes inherited from ACAPI::v1::Object
std::shared_ptr< Impl::ObjectImplmImpl
 Impl object given by constructor.
 

Detailed Description

A class that contains functions related to zone labeling by favorite.

Since
Archicad 28

Member Function Documentation

◆ GetSelectedFavoriteName()

Result< GS::UniString > ACAPI::v1::ZoneLabelingSettings::GetSelectedFavoriteName ( ) const

A function to return the selected favorite from infobox for zone.

Returns
Returns an error if the process fails for some reason, otherwise the selected favorite from infobox.
  • APIERR_GENERAL - Label favorite could not find.
Example
ACAPI::Result<GS::UniString> result = zoneLabelingSetting.GetSelectedFavoriteName ();
if (result.IsErr ()) {
ACAPI_WriteReport (result.UnwrapErr ().text.c_str (), true);
return;
}
API_Favorite favorite (result.Unwrap ());
Result is the standard return type of API functions.
Definition: Result.hpp:845
std::enable_if_t<!std::is_same_v< U, void >, U > && Unwrap() &&
Unwraps the value contained in the Result. Trying to Unwrap the value while it contains an error will...
Definition: Result.hpp:1087
E UnwrapErr() const
Unwraps the error value contained in the Result. Trying to UnwrapErr the value while it contains an O...
Definition: Result.hpp:1140
bool IsErr() const
Definition: Result.hpp:945
void ACAPI_WriteReport(const GS::UniString &format, bool withDial,...)
Writes a report string into the Report Windowot into a custom alert window.
A container for Favorite entry settings.
Definition: APIdefs_Favorite.h:44

◆ IsAutomaticLabelingOn()

bool ACAPI::v1::ZoneLabelingSettings::IsAutomaticLabelingOn ( ) const

A function to return if a label should automatically be placed onto new zone or not.

Returns
Returns if a label should automatically be placed onto new zones or not.

◆ Modify()

template<class ModifierFunc >
Result< void > ACAPI::v1::ZoneLabelingSettings::Modify ( ModifierFunc &&  modifierFunc)

Executes the given modifier scope in a NotUndoable command.

Parameters
modifierFuncThe modifier scope (lambda, std::function or function pointer) the caller wants to execute.
Returns
Returns an error if the process of modification fails for some reason, otherwise nothing.

◆ SetAutomaticLabeling()

void ACAPI::v1::ZoneLabelingSettings::SetAutomaticLabeling ( bool  labeling)

A function to set whether a label should automatically be placed onto new zones or not.

Parameters
labeling[in] The logical value to be set, if label should be placed or not.
Example
ACAPI::Result<void> result = zoneLabelingSetting.Modify ([&] (ACAPI::ZoneLabelingSettings::Modifier& modifier) {
modifier.SetAutomaticLabeling (!zoneLabelingSetting.IsAutomaticLabelingOn ());
});
A class that contains functions related to zone labeling by favorite.
Definition: ZoneLabelingSettings.hpp:53
bool IsAutomaticLabelingOn() const
A function to return if a label should automatically be placed onto new zone or not.
Result< void > Modify(ModifierFunc &&modifierFunc)
Executes the given modifier scope in a NotUndoable command.
Definition: ZoneLabelingSettings.hpp:115
ZoneLabelingSettings CreateZoneLabelingSettings()
A function to create zone labeling settings instance, that lets you query and manipulate zone label f...
Definition: ZoneLabelingSettings.hpp:127

◆ SetSelectedFavorite()

Result< void > ACAPI::v1::ZoneLabelingSettings::SetSelectedFavorite ( const GS::UniString &  favoriteName)

A function to set the label favorite that should be used for the automatic labeling of zones.

Parameters
favoriteName[in] The name of the label favorite.
Returns
Returns an error if the favoriteName is incorrect, otherwise nothing.
  • APIERR_GENERAL - There is no favorite in the list.
  • APIERR_BADNAME - Favorite for the favorite name does not exist.
  • APIERR_BADELEMENTTYPE - Favorite is not a label favorite.
Example
ACAPI::Result<void> result = zoneLabelingSetting.Modify ([&] (ACAPI::ZoneLabelingSettings::Modifier& modifier) {
modifier.SetSelectedFavorite (names[0]);
});
if (result.IsErr ()) {
ACAPI_WriteReport (result.UnwrapErr ().text.c_str (), true);
return;
}

Friends And Related Symbol Documentation

◆ CreateZoneLabelingSettings

ZoneLabelingSettings CreateZoneLabelingSettings ( )
friend

A function to create zone labeling settings instance, that lets you query and manipulate zone label favorite related data.

Returns
Returns the zone labeling settings instance.