/**
 * Default constructor.
 */
RS_Graphic::RS_Graphic(RS_EntityContainer* parent)
        : RS_Document(parent),
        layerList(),
blockList(true)
#ifdef RS_CAM
, camData()
#endif
{

    RS_SETTINGS->beginGroup("/Defaults");
    setUnit(RS_Units::stringToUnit(RS_SETTINGS->readEntry("/Unit", "None")));
    RS_SETTINGS->endGroup();

    RS2::Unit unit = getUnit();

    if (unit==RS2::Inch) {
        addVariable("$DIMASZ", 0.1, 40);
        addVariable("$DIMEXE", 0.05, 40);
        addVariable("$DIMEXO", 0.025, 40);
        addVariable("$DIMGAP", 0.025, 40);
        addVariable("$DIMTXT", 0.1, 40);
    } else {
        addVariable("$DIMASZ",
                    RS_Units::convert(2.5, RS2::Millimeter, unit), 40);
        addVariable("$DIMEXE",
                    RS_Units::convert(1.25, RS2::Millimeter, unit), 40);
        addVariable("$DIMEXO",
                    RS_Units::convert(0.625, RS2::Millimeter, unit), 40);
        addVariable("$DIMGAP",
                    RS_Units::convert(0.625, RS2::Millimeter, unit), 40);
        addVariable("$DIMTXT",
                    RS_Units::convert(2.5, RS2::Millimeter, unit), 40);
    }
	setModified(false);
}
Example #2
0
// read in a factor from the specified line of a file
bool PolynomialFunction::readFactor( string const & line,
									 VariableID & unique_var_id ) {
	// create a new factor and put it in the factor list
	NonlinearProductFactor * f = new NonlinearProductFactor( factors.size() );
	factors.push_back( f );

	string name;
	Numeric exponent = 1.0;
	Variable * v( NULL );

	std::vector< string > sv1, sv2;
	BOOSTNS::split( sv1, line, BOOSTNS::is_any_of( "," ) );
	assert( !sv1.empty() );

	// Iterate through the split up parts of the string -- these should be of
	// the form [ x0^e ], where x0 is the variable name and e is the exponent.
	// These can also just be a single constant with no variables, which is
	// then simply interpreted as [ k ], where k is the constant.
	for ( const string & s : sv1 ) {
		BOOSTNS::split( sv2, s, BOOSTNS::is_any_of( "^" ) );
		assert( sv2.size() == 1 || sv2.size() == 2 );
		if ( sv2.empty() || sv2.size() > 2 ) {
			std::cout << "ERROR: Invalid term when reading PolynomialFunction at '"
				<< s << "' in line: '" << line << "'" << std::endl;
			throw "Invalid split when reading PolynomialFunction";
		}

		name = BOOSTNS::algorithm::to_lower_copy( BOOSTNS::trim_copy( sv2[0] ) );
		exponent = 1.0;

		Variable * v = NULL;

		if ( sv2.size() == 1 ) {
			try {
				Numeric constant = BOOSTNS::lexical_cast< Numeric >( name );
				// if this doesn't throw, then this is simply a constant
				f->setCoeff( constant );
			} catch ( BOOSTNS::bad_lexical_cast & ) {
				// if this threw, then it's not a number
				v = addVariable( name, "", unique_var_id );
			}
		} else {
			assert( sv2.size() == 2 );
			v = addVariable( name, "", unique_var_id );
			try {
				exponent = BOOSTNS::lexical_cast< Numeric >(
						BOOSTNS::trim_copy( sv2[1] ) );
			} catch ( BOOSTNS::bad_lexical_cast & e ) {
				std::cout << "ERROR: Invalid exponent when reading PolynomialFunction at '"
						<< s << "' in line: '" << line << "'" << std::endl;
				throw e;
			}
		}

		if ( v != NULL ) f->addVariable( v, exponent, 0, false );
	}

	return true;
}
ChatOnReceiveRoomInvitation::ChatOnReceiveRoomInvitation(const std::string & r, const ChatAvatarId & id) :
GameNetworkMessage("ChatOnReceiveRoomInvitation"),
invitorAvatar(id),
roomName(r)
{
	addVariable(invitorAvatar);
	addVariable(roomName);
}
ChatInviteGroupToRoom::ChatInviteGroupToRoom(const ChatAvatarId & a, const std::string & r) :
GameNetworkMessage("ChatInviteGroupToRoom"),
avatarId(a),
roomName(r)
{
	addVariable(avatarId);
	addVariable(roomName);
}
ChatOnDeleteAllPersistentMessages::ChatOnDeleteAllPersistentMessages(std::string const &targetName, bool const success)
 : GameNetworkMessage("ChatOnDeleteAllPersistentMessages")
 , m_targetName(targetName)
 , m_success(success)
{
	addVariable(m_targetName);
	addVariable(m_success);
}
PreloadRequestCompleteMessage::PreloadRequestCompleteMessage(uint32 gameServerId, uint32 preloadAreaId) :
		GameNetworkMessage("PreloadRequestCompleteMessage"),
		m_gameServerId(gameServerId),
		m_preloadAreaId(preloadAreaId)
{
	addVariable(m_gameServerId);
	addVariable(m_preloadAreaId);
}
NewGameServer::NewGameServer(const std::string & sceneName, uint32 serverId) : 
		GameNetworkMessage("NewGameServer"),
		m_sceneName(sceneName),
		m_serverId(serverId)
{
	addVariable(m_sceneName);
	addVariable(m_serverId);
}
LoginCreateCharacterAckMessage::LoginCreateCharacterAckMessage (const StationId &stationId, const NetworkId &characterNetworkId) :
		GameNetworkMessage("LoginCreateCharacterAckMessage"),
		m_stationId(stationId),
		m_characterNetworkId(characterNetworkId)
{
	addVariable(m_stationId);
	addVariable(m_characterNetworkId);
}
ChatAddFriend::ChatAddFriend(const unsigned int q, const ChatAvatarId & c) :
GameNetworkMessage("ChatAddFriend"),
characterName(c),
sequence(q)
{
	addVariable(characterName);
	addVariable(sequence);
}
GameSetClusterName::GameSetClusterName(const std::string & newClusterName, const std::string & newGameServerName) :
GameNetworkMessage("GameSetClusterName"),
clusterName(newClusterName),
gameServerName(newGameServerName)
{
	addVariable(clusterName);
	addVariable(gameServerName);
}
NewbieTutorialHighlightUIElement::NewbieTutorialHighlightUIElement (const std::string & widgetPath, float time) :
	GameNetworkMessage ("NewbieTutorialHighlightUIElement"),
	m_time (time),
	m_widgetPath (widgetPath)
{
	addVariable (m_time);
	addVariable (m_widgetPath);
}
ValidateCharacterForLoginMessage::ValidateCharacterForLoginMessage(StationId suid, const NetworkId &characterId) :
		GameNetworkMessage("ValidateCharacterForLoginMessage"),
		m_suid(suid),
		m_characterId(characterId)
{
	addVariable(m_suid);
	addVariable(m_characterId);
}
ValidateCharacterForLoginMessage::ValidateCharacterForLoginMessage(Archive::ReadIterator & source) :
		GameNetworkMessage("ValidateCharacterForLoginMessage")
{
	addVariable(m_suid);
	addVariable(m_characterId);

	unpack(source);
}
ServerWeatherMessage::ServerWeatherMessage (const int index, const Vector& windVelocity_w) :
	GameNetworkMessage (ServerWeatherMessage::cms_name),
	m_index (index),
	m_windVelocity_w (windVelocity_w)
{
	addVariable (m_index);
	addVariable (m_windVelocity_w);
}
LoginClusterName::LoginClusterName(const std::string & clusterName, int timeZone) :
GameNetworkMessage("LoginClusterName"),
m_clusterName(clusterName),
m_timeZone(timeZone)
{
	addVariable(m_clusterName);
	addVariable(m_timeZone);
}
DropClient::DropClient(NetworkId oid) : 
		GameNetworkMessage("DropClient"),
		m_oid(oid),
		m_immediate(false)
{
	addVariable(m_oid);
	addVariable(m_immediate);
}
SynchronizeScriptVarDeltasMessage::SynchronizeScriptVarDeltasMessage(NetworkId const &networkId, std::vector<int8> const &data) :
    GameNetworkMessage("SynchronizeScriptVarDeltasMessage"),
    m_networkId(networkId),
    m_data(data)
{
    addVariable(m_networkId);
    addVariable(m_data);
}
KickPlayer::KickPlayer(const NetworkId& oid, const std::string& reason) : 
	GameNetworkMessage("KickPlayer"),
	m_oid(oid),
	m_reason(reason)
{
	addVariable(m_oid);
	addVariable(m_reason);
}
RequestOIDsMessage::RequestOIDsMessage(Archive::ReadIterator & source) :
		GameNetworkMessage("RequestOIDsMessage")
{
	addVariable(m_serverId);
	addVariable(m_howMany);
	addVariable(m_logRequest);
	unpack(source);
}
ServerWeatherMessage::ServerWeatherMessage (Archive::ReadIterator& source) :
	GameNetworkMessage (ServerWeatherMessage::cms_name),
	m_index (),
	m_windVelocity_w ()
{
	addVariable (m_index);
	addVariable (m_windVelocity_w);
	unpack (source);
}
ExcommunicateGameServerMessage::ExcommunicateGameServerMessage(Archive::ReadIterator & source) :
		GameNetworkMessage("ExcommunicateGameServerMessage"),
		m_serverId()
{
	addVariable(m_serverId);
	addVariable(m_processId);
	addVariable(m_hostName);
	unpack(source);
}
LoginClusterName::LoginClusterName(Archive::ReadIterator & source) :
GameNetworkMessage("LoginClusterName"),
m_clusterName(),
m_timeZone()
{
	addVariable(m_clusterName);
	addVariable(m_timeZone);
	AutoByteStream::unpack(source);
}
NewGameServer::NewGameServer (Archive::ReadIterator & source) : 
		GameNetworkMessage("NewGameServer"),
		m_sceneName(),
		m_serverId(0)
{
	addVariable(m_sceneName);
	addVariable(m_serverId);
	unpack(source);
}
KickPlayer::KickPlayer(Archive::ReadIterator &source) : 
	GameNetworkMessage("KickPlayer"),
	m_oid(NetworkId::cms_invalid),
	m_reason("")
{
	addVariable(m_oid);
	addVariable(m_reason);
	unpack(source);
}
DropClient::DropClient (Archive::ReadIterator & source) : 
		GameNetworkMessage("DropClient"),
		m_oid(NetworkId::cms_invalid),
		m_immediate(false)
{
	addVariable(m_oid);
	addVariable(m_immediate);
	unpack(source);
}
NewbieTutorialHighlightUIElement::NewbieTutorialHighlightUIElement (Archive::ReadIterator& source) :
	GameNetworkMessage ("NewbieTutorialHighlightUIElement"),
	m_time (),
	m_widgetPath ()
{
	addVariable(m_time);
	addVariable (m_widgetPath);
	unpack (source);
}
ResourceListForSurveyMessage::ResourceListForSurveyMessage(Archive::ReadIterator & source) :
		GameNetworkMessage(MessageType),
		m_data()
{
	addVariable(m_data);
	addVariable(m_surveyType);
	addVariable(m_surveyToolId);
	unpack(source);
}
ChatAddFriend::ChatAddFriend(Archive::ReadIterator & source) :
GameNetworkMessage("ChatAddFriend"),
characterName(),
sequence()
{
	addVariable(characterName);
	addVariable(sequence);
	unpack(source);
}
PreloadRequestCompleteMessage::PreloadRequestCompleteMessage(Archive::ReadIterator & source) :
		GameNetworkMessage("PreloadRequestCompleteMessage"),
		m_gameServerId(),
		m_preloadAreaId()
{
	addVariable(m_gameServerId);
	addVariable(m_preloadAreaId);
	unpack(source);
}
GetArticleMessage::GetArticleMessage(Archive::ReadIterator &source) :
GameNetworkMessage("GetArticleMessage"),
m_id(),
m_language()
{
	addVariable(m_id);
	addVariable(m_language);
	unpack(source);
}