<commit_before>/*************************************************************************/
/*  editor_path.cpp                                                      */
/*************************************************************************/
/*                       This file is part of:                           */
/*                           GODOT ENGINE                                */
/*                      https://godotengine.org                          */
/*************************************************************************/
/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur.                 */
/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md)    */
/*                                                                       */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the       */
/* "Software"), to deal in the Software without restriction, including   */
/* without limitation the rights to use, copy, modify, merge, publish,   */
/* distribute, sublicense, and/or sell copies of the Software, and to    */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions:                                             */
/*                                                                       */
/* The above copyright notice and this permission notice shall be        */
/* included in all copies or substantial portions of the Software.       */
/*                                                                       */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,       */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF    */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY  */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,  */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE     */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                */
/*************************************************************************/

#include "editor_path.h"

#include "editor_node.h"
#include "editor_scale.h"

void EditorPath::_add_children_to_popup(Object *p_obj, int p_depth) {

	if (p_depth > 8)
		return;

	List<PropertyInfo> pinfo;
	p_obj->get_property_list(&pinfo);
	for (List<PropertyInfo>::Element *E = pinfo.front(); E; E = E->next()) {

		if (!(E->get().usage & PROPERTY_USAGE_EDITOR))
			continue;
		if (E->get().hint != PROPERTY_HINT_RESOURCE_TYPE)
			continue;

		Variant value = p_obj->get(E->get().name);
		if (value.get_type() != Variant::OBJECT)
			continue;
		Object *obj = value;
		if (!obj)
			continue;

		Ref<Texture> icon = EditorNode::get_singleton()->get_object_icon(obj);

		int index = popup->get_item_count();
		popup->add_icon_item(icon, E->get().name.capitalize(), objects.size());
		popup->set_item_h_offset(index, p_depth * 10 * EDSCALE);
		objects.push_back(obj->get_instance_id());

		_add_children_to_popup(obj, p_depth + 1);
	}
}

void EditorPath::_gui_input(const Ref<InputEvent> &p_event) {

	Ref<InputEventMouseButton> mb = p_event;
	if (mb.is_valid() && mb->get_button_index() == BUTTON_LEFT && mb->is_pressed()) {

		Object *obj = ObjectDB::get_instance(history->get_path_object(history->get_path_size() - 1));
		if (!obj)
			return;

		objects.clear();
		popup->clear();
		_add_children_to_popup(obj);
		popup->set_position(get_global_position() + Vector2(0, get_size().height));
		popup->set_size(Size2(get_size().width, 1));
		popup->popup();
	}
}

void EditorPath::_notification(int p_what) {

	switch (p_what) {

		case NOTIFICATION_MOUSE_ENTER: {
			mouse_over = true;
			update();
		} break;
		case NOTIFICATION_MOUSE_EXIT: {
			mouse_over = false;
			update();
		} break;
		case NOTIFICATION_DRAW: {

			RID ci = get_canvas_item();
			Ref<Font> label_font = get_font("font", "Label");
			Size2i size = get_size();
			Ref<Texture> sn = get_icon("SmallNext", "EditorIcons");
			Ref<StyleBox> sb = get_stylebox("pressed", "Button");

			int ofs = sb->get_margin(MARGIN_LEFT);

			if (mouse_over) {
				draw_style_box(sb, Rect2(Point2(), get_size()));
			}

			for (int i = 0; i < history->get_path_size(); i++) {

				Object *obj = ObjectDB::get_instance(history->get_path_object(i));
				if (!obj)
					continue;

				String type = obj->get_class();

				Ref<Texture> icon = EditorNode::get_singleton()->get_object_icon(obj);

				icon->draw(ci, Point2i(ofs, (size.height - icon->get_height()) / 2));

				ofs += icon->get_width();

				if (i == history->get_path_size() - 1) {
					//add name
					ofs += 4;
					int left = size.width - ofs;
					if (left < 0)
						continue;
					String name;
					if (Object::cast_to<Resource>(obj)) {

						Resource *r = Object::cast_to<Resource>(obj);
						if (r->get_path().is_resource_file())
							name = r->get_path().get_file();
						else
							name = r->get_name();

						if (name == "")
							name = r->get_class();
					} else if (obj->is_class("ScriptEditorDebuggerInspectedObject"))
						name = obj->call("get_title");
					else if (Object::cast_to<Node>(obj))
						name = Object::cast_to<Node>(obj)->get_name();
					else if (Object::cast_to<Resource>(obj) && Object::cast_to<Resource>(obj)->get_name() != "")
						name = Object::cast_to<Resource>(obj)->get_name();
					else
						name = obj->get_class();

					set_tooltip(obj->get_class());

					label_font->draw(ci, Point2i(ofs, (size.height - label_font->get_height()) / 2 + label_font->get_ascent()), name, get_color("font_color", "Label"), left);
				} else {
					//add arrow

					//sn->draw(ci,Point2i(ofs,(size.height-sn->get_height())/2));
					//ofs+=sn->get_width();
					ofs += 5; //just looks better! somehow
				}
			}

		} break;
	}
}

void EditorPath::update_path() {

	update();
}

void EditorPath::_popup_select(int p_idx) {

	ERR_FAIL_INDEX(p_idx, objects.size());

	Object *obj = ObjectDB::get_instance(objects[p_idx]);
	if (!obj)
		return;

	EditorNode::get_singleton()->push_item(obj);
}

void EditorPath::_bind_methods() {

	ClassDB::bind_method("_gui_input", &EditorPath::_gui_input);
	ClassDB::bind_method("_popup_select", &EditorPath::_popup_select);
}

EditorPath::EditorPath(EditorHistory *p_history) {

	history = p_history;
	mouse_over = false;
	popup = memnew(PopupMenu);
	popup->connect("id_pressed", this, "_popup_select");
	add_child(popup);
}
<commit_msg>Fixed null editor icon crash<commit_after>/*************************************************************************/
/*  editor_path.cpp                                                      */
/*************************************************************************/
/*                       This file is part of:                           */
/*                           GODOT ENGINE                                */
/*                      https://godotengine.org                          */
/*************************************************************************/
/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur.                 */
/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md)    */
/*                                                                       */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the       */
/* "Software"), to deal in the Software without restriction, including   */
/* without limitation the rights to use, copy, modify, merge, publish,   */
/* distribute, sublicense, and/or sell copies of the Software, and to    */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions:                                             */
/*                                                                       */
/* The above copyright notice and this permission notice shall be        */
/* included in all copies or substantial portions of the Software.       */
/*                                                                       */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,       */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF    */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY  */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,  */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE     */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                */
/*************************************************************************/

#include "editor_path.h"

#include "editor_node.h"
#include "editor_scale.h"

void EditorPath::_add_children_to_popup(Object *p_obj, int p_depth) {

	if (p_depth > 8)
		return;

	List<PropertyInfo> pinfo;
	p_obj->get_property_list(&pinfo);
	for (List<PropertyInfo>::Element *E = pinfo.front(); E; E = E->next()) {

		if (!(E->get().usage & PROPERTY_USAGE_EDITOR))
			continue;
		if (E->get().hint != PROPERTY_HINT_RESOURCE_TYPE)
			continue;

		Variant value = p_obj->get(E->get().name);
		if (value.get_type() != Variant::OBJECT)
			continue;
		Object *obj = value;
		if (!obj)
			continue;

		Ref<Texture> icon = EditorNode::get_singleton()->get_object_icon(obj);

		int index = popup->get_item_count();
		popup->add_icon_item(icon, E->get().name.capitalize(), objects.size());
		popup->set_item_h_offset(index, p_depth * 10 * EDSCALE);
		objects.push_back(obj->get_instance_id());

		_add_children_to_popup(obj, p_depth + 1);
	}
}

void EditorPath::_gui_input(const Ref<InputEvent> &p_event) {

	Ref<InputEventMouseButton> mb = p_event;
	if (mb.is_valid() && mb->get_button_index() == BUTTON_LEFT && mb->is_pressed()) {

		Object *obj = ObjectDB::get_instance(history->get_path_object(history->get_path_size() - 1));
		if (!obj)
			return;

		objects.clear();
		popup->clear();
		_add_children_to_popup(obj);
		popup->set_position(get_global_position() + Vector2(0, get_size().height));
		popup->set_size(Size2(get_size().width, 1));
		popup->popup();
	}
}

void EditorPath::_notification(int p_what) {

	switch (p_what) {

		case NOTIFICATION_MOUSE_ENTER: {
			mouse_over = true;
			update();
		} break;
		case NOTIFICATION_MOUSE_EXIT: {
			mouse_over = false;
			update();
		} break;
		case NOTIFICATION_DRAW: {

			RID ci = get_canvas_item();
			Ref<Font> label_font = get_font("font", "Label");
			Size2i size = get_size();
			Ref<Texture> sn = get_icon("SmallNext", "EditorIcons");
			Ref<StyleBox> sb = get_stylebox("pressed", "Button");

			int ofs = sb->get_margin(MARGIN_LEFT);

			if (mouse_over) {
				draw_style_box(sb, Rect2(Point2(), get_size()));
			}

			for (int i = 0; i < history->get_path_size(); i++) {

				Object *obj = ObjectDB::get_instance(history->get_path_object(i));
				if (!obj)
					continue;

				String type = obj->get_class();

				Ref<Texture> icon = EditorNode::get_singleton()->get_object_icon(obj);

				if (icon.is_valid()) {
					icon->draw(ci, Point2i(ofs, (size.height - icon->get_height()) / 2));
					ofs += icon->get_width();
				}

				if (i == history->get_path_size() - 1) {
					//add name
					ofs += 4;
					int left = size.width - ofs;
					if (left < 0)
						continue;
					String name;
					if (Object::cast_to<Resource>(obj)) {

						Resource *r = Object::cast_to<Resource>(obj);
						if (r->get_path().is_resource_file())
							name = r->get_path().get_file();
						else
							name = r->get_name();

						if (name == "")
							name = r->get_class();
					} else if (obj->is_class("ScriptEditorDebuggerInspectedObject"))
						name = obj->call("get_title");
					else if (Object::cast_to<Node>(obj))
						name = Object::cast_to<Node>(obj)->get_name();
					else if (Object::cast_to<Resource>(obj) && Object::cast_to<Resource>(obj)->get_name() != "")
						name = Object::cast_to<Resource>(obj)->get_name();
					else
						name = obj->get_class();

					set_tooltip(obj->get_class());

					label_font->draw(ci, Point2i(ofs, (size.height - label_font->get_height()) / 2 + label_font->get_ascent()), name, get_color("font_color", "Label"), left);
				} else {
					//add arrow

					//sn->draw(ci,Point2i(ofs,(size.height-sn->get_height())/2));
					//ofs+=sn->get_width();
					ofs += 5; //just looks better! somehow
				}
			}

		} break;
	}
}

void EditorPath::update_path() {

	update();
}

void EditorPath::_popup_select(int p_idx) {

	ERR_FAIL_INDEX(p_idx, objects.size());

	Object *obj = ObjectDB::get_instance(objects[p_idx]);
	if (!obj)
		return;

	EditorNode::get_singleton()->push_item(obj);
}

void EditorPath::_bind_methods() {

	ClassDB::bind_method("_gui_input", &EditorPath::_gui_input);
	ClassDB::bind_method("_popup_select", &EditorPath::_popup_select);
}

EditorPath::EditorPath(EditorHistory *p_history) {

	history = p_history;
	mouse_over = false;
	popup = memnew(PopupMenu);
	popup->connect("id_pressed", this, "_popup_select");
	add_child(popup);
}
<|endoftext|>


<commit_before>#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <cctype>
using namespace std;

struct cmpItem
{
	bool operator()(const pair<string, int>& a, const pair<string, int>& b)
	{
		if (a.second != b.second) return a.second > b.second;
		else return a.first < b.first;
	}
};

int main()
{
	freopen("input.txt", "r", stdin);
	map<string, int> table;
	int n = 0;
	cin >> n;
	cin.ignore();

	string line;
	for (int i = 0; i < n; ++i)
	{
		getline(cin, line);
		int pos1 = 0;
		while (line[pos1] != '#') pos1++;
		int pos2 = pos1 + 1;
		while (line[pos2] != '#') pos2++;
		string topic = line.substr(pos1+1, pos2 - pos1 - 1);
		string finalTopic;
		finalTopic.reserve(topic.size());
		for (size_t i = 0; i < topic.size(); ++i)
		{
			if (isalpha(topic[i]) || isdigit(topic[i]) || isspace(topic[i]))
			{
				finalTopic.push_back(tolower(topic[i]));
			}
		}
		//cout << "final topic:" << finalTopic << endl;
		if (finalTopic.size() > 40) finalTopic = finalTopic.substr(0, 40);
		table[finalTopic]++;
	}

	vector<pair<string, int> > v;
	for (auto it = table.begin(); it != table.end(); ++it)
	{
		v.push_back(*it);
	}

	sort(v.begin(), v.end(), cmpItem());
	string t = v[0].first;
	if (islower(t[0])) t[0] = toupper(t[0]);
	cout << t << endl;
	cout << v[0].second << endl;

	int cnt = 0;
	for (int i = 1; i < v.size(); ++i)
	{
		if (v[i].second == v[0].second) cnt++;
	}
	if (cnt != 0) cout << "And " << cnt << " more ..." << endl;

	return 0;

}
<commit_msg>last sample TLE, todo<commit_after>#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <cctype>
using namespace std;

struct cmpItem
{
	bool operator()(const pair<string, int>& a, const pair<string, int>& b)
	{
		if (a.second != b.second) return a.second > b.second;
		else return a.first < b.first;
	}
};

int main()
{
	freopen("input.txt", "r", stdin);
	map<string, int> table;
	int n = 0;
	scanf("%d\n", &n);

	string line;
	for (int i = 0; i < n; ++i)
	{
		getline(cin, line);

		int curPos = 0;
		int lsz = line.size();

		set<string> curLineTopics;
		while (curPos < lsz)
		{
			int pos1 = curPos;
			while (pos1 < lsz && line[pos1] != '#') pos1++;
			int pos2 = pos1 + 1;
			while (pos2 < lsz && line[pos2] != '#') pos2++;
			if (pos1 >= lsz || pos2 >= lsz)
			{
				break;
			}

			string topic = line.substr(pos1+1, pos2 - pos1 - 1);
			string finalTopic;
			finalTopic.reserve(topic.size());
			for (size_t i = 0; i < topic.size(); ++i)
			{
				if (isalpha(topic[i]) || isdigit(topic[i]) || isspace(topic[i]))
				{
					finalTopic.push_back(tolower(topic[i]));
				}
				if (topic[i] == '@')
				{
					finalTopic.push_back(' ');
				}
			}
			//cout << "final topic:" << finalTopic << endl;
			if (finalTopic.size() > 40) finalTopic = finalTopic.substr(0, 40);

			curLineTopics.insert(finalTopic);

			//table[finalTopic]++;

			curPos = pos2 + 1;
		}

		for (auto it = curLineTopics.begin(); it != curLineTopics.end(); ++it)
		{
			table[*it]++;
		}
	}

	vector<pair<string, int> > v;
	for (auto it = table.begin(); it != table.end(); ++it)
	{
		v.push_back(*it);
	}

	sort(v.begin(), v.end(), cmpItem());
	string t = v[0].first;
	if (islower(t[0])) t[0] = toupper(t[0]);
	cout << t << endl;
	cout << v[0].second << endl;

	int cnt = 0;
	for (int i = 1; i < v.size(); ++i)
	{
		if (v[i].second == v[0].second) cnt++;
	}
	if (cnt != 0) cout << "And " << cnt << " more ..." << endl;

	return 0;

}
<|endoftext|>


<commit_before>  ///////////////////////////////////////////////////////////////////////////
  ///\file AddTaskEMCALPhotonIsolation.C
  ///\brief Configuration of AliAnalysisTaskEMCALPhotonIsolation
  ///
  /// Version to be used in lego train for testing on pp@7TeV
  ///
  /// \author Lucile Ronflette <lucile.ronflette@cern.ch>, SUBATECH, Nantes
  /// \author Davide Francesco Lodato <davide.francesco.lodato@cern.ch>, Utrecht University
  /// \author Marco Marquard <marco.marquard@cern.ch>, University Frankfurt am Main
  ///////////////////////////////////////////////////////////////////////////

AliAnalysisTaskEMCALPhotonIsolation* AddTaskEMCALPhotonIsolation(
                                                                 const char*            periodstr                 = "LHC11c",
                                                                 const char*            ntracks                   = "EmcalTracks",
                                                                 const char*            nclusters                 = "EmcCaloClusters",
                                                                 const UInt_t           pSel                      = AliVEvent::kEMC7,
                                                                 const TString          dType                     = "ESD",
                                                                 const Bool_t	        bHisto                    = kTRUE,
                                                                 const Int_t	        iOutput	  	          = 0,
                                                                 const Bool_t	        bIsMC  	                  = kFALSE,
                                                                 const Bool_t           bMCNormalization          = kFALSE,
                                                                 const Bool_t           bNLMCut                   = kFALSE,
                                                                 const Int_t            NLMCut                    = 0,
                                                                 const Double_t         minPtCutCluster           = 0.3,
                                                                 const Double_t         EtIso                     = 2.,
                                                                 const Int_t            iIsoMethod                = 1,
                                                                 const Int_t            iEtIsoMethod              = 0,
                                                                 const Int_t            iUEMethod                 = 1,
                                                                 const Bool_t           bUseofTPC                 = kFALSE,
                                                                 const Double_t         TMdeta                    = 0.02,
                                                                 const Double_t         TMdphi                    = 0.03,
                                                                 const Bool_t           bTMClusterRejection       = kTRUE,
                                                                 const Bool_t           bTMClusterRejectionInCone = kTRUE,
                                                                 const Float_t          iIsoConeRadius            = 0.4,
                                                                 const Bool_t           iSmearingSS               = kFALSE,
                                                                 const Float_t          iWidthSSsmear             = 0.,
                                                                 const Float_t          iMean_SSsmear             = 0.,
                                                                 const Bool_t           iExtraIsoCuts             = kFALSE,
                                                                 const Bool_t           i_pPb                     = kFALSE,
                                                                 const Bool_t           isQA                      = kFALSE,
                                                                 TString                configBasePath            = "",
                                                                 const Int_t            bWhichToSmear             = 0,
                                                                 const Int_t            minNLM                    = 1,
                                                                 const Double_t         TMdetaIso                 = 0.02,
                                                                 const Double_t         TMdphiIso                 = 0.03,
                                                                 const Bool_t           bmcTruth                  = kTRUE,
                                                                 const Bool_t           isLCAnalysis              = kFALSE,
                                                                 TString                L1triggerName             = "",
                                                                 const Bool_t           RejectPileUpEvent        = kFALSE,
                                                                 const Int_t            NContrToPileUp           = 3
                                                                 )
{
  Printf("Preparing neutral cluster analysis\n");

  // #### Define manager and data container names
  AliAnalysisManager *manager = AliAnalysisManager::GetAnalysisManager();
  if(!manager){
    ::Error("AddTaskEMCALPhotonIsolation", "No analysis manager to connect to.");
    return NULL;
  }

  // Use the input containers naming convention with "usedefault" (already used in several EMCal tasks and new correction framework)
  TString trackName(ntracks);
  TString clusName(nclusters);

  if(trackName == "usedefault"){
    if(dType == "ESD"){
      trackName = "Tracks";
    }
    else if(dType == "AOD"){
      trackName = "tracks";
    }
    else{
      trackName = "";
    }
  }

  if(clusName == "usedefault"){
    if(dType == "ESD"){
      clusName = "CaloClusters";
    }
    else if(dType == "AOD"){
      clusName = "caloClusters";
    }
    else{
      clusName = "";
    }
  }

  // Set the task output container name
  Printf("Creating container name for cluster analysis\n");

  TString myContName("");
  if(bIsMC){
    myContName = Form("Analysis_Neutrals_MC");
  }
  else{
    myContName = Form("Analysis_Neutrals");
  }

  if(L1triggerName.Contains("EG1") || L1triggerName.Contains("EGA1")){
    L1triggerName = "EG1";
  }
  else if(L1triggerName.Contains("EG2") || L1triggerName.Contains("EGA2")){
    L1triggerName = "EG2";
  }
  else{
    L1triggerName = "";
  }

  if(L1triggerName != ""){
    myContName.Append(Form("%s_TM_%s_CPVe%.2lf_CPVp%.2lf_IsoMet%d_EtIsoMet%d_UEMet%d_TPCbound_%s_IsoConeR%.1f_NLMCut_%s_minNLM%d_maxNLM%d_SSsmear_%s_Width%.3f_Mean_%.3f_PureIso_%s_WhichSmear_%d_Trigger_%s",isLCAnalysis?"_LC_Yes":"",bTMClusterRejection? "On" :"Off", TMdeta , TMdphi ,iIsoMethod,iEtIsoMethod,iUEMethod,bUseofTPC ? "Yes" : "No",iIsoConeRadius,bNLMCut ? "On": "Off",minNLM, NLMCut, iSmearingSS ? "On":"Off",iWidthSSsmear,iMean_SSsmear,iExtraIsoCuts?"On":"Off",bWhichToSmear,L1triggerName.Data()));
  }
  else{
    myContName.Append(Form("%s_TM_%s_CPVe%.2lf_CPVp%.2lf_IsoMet%d_EtIsoMet%d_UEMet%d_TPCbound_%s_IsoConeR%.1f_NLMCut_%s_minNLM%d_maxNLM%d_SSsmear_%s_Width%.3f_Mean_%.3f_PureIso_%s_WhichSmear_%d",isLCAnalysis?"_LC_Yes":"",bTMClusterRejection? "On" :"Off", TMdeta , TMdphi ,iIsoMethod,iEtIsoMethod,iUEMethod,bUseofTPC ? "Yes" : "No",iIsoConeRadius,bNLMCut ? "On": "Off",minNLM, NLMCut, iSmearingSS ? "On":"Off",iWidthSSsmear,iMean_SSsmear,iExtraIsoCuts?"On":"Off",bWhichToSmear));
  }

  // #### Define analysis task
  AliAnalysisTaskEMCALPhotonIsolation* task = new AliAnalysisTaskEMCALPhotonIsolation("Analysis",bHisto);

  TString configFile("config_PhotonIsolation.C"); // Name of config file
  //  if(gSystem->AccessPathName(configFile.Data())){ // Check for exsisting file and delete it
  //    gSystem->Exec(Form("rm %s",configFile.Data()));
  //  }

  if(configBasePath.IsNull()){ // Check if a specific config should be used and copy appropriate file
    configBasePath="$ALICE_PHYSICS/PWGGA/EMCALTasks/macros";
    gSystem->Exec(Form("cp %s/%s .",configBasePath.Data(),configFile.Data()));
  }
  else if(configBasePath.Contains("alien:///")){
    gSystem->Exec(Form("alien_cp %s/%s .",configBasePath.Data(),configFile.Data()));
  }
  else{
    gSystem->Exec(Form("cp %s/%s .",configBasePath.Data(),configFile.Data()));
  }

  configBasePath=Form("%s/",gSystem->pwd());
  ifstream configIn; // Open config file for hash calculation
  configIn.open(configFile);
  TString configStr;
  configStr.ReadFile(configIn);
  TString configMD5 = configStr.MD5();
  configMD5.Resize(5); // Short hash value for usable extension
  TString configFileMD5 = configFile;
  TDatime time; // Get timestamp
  Int_t timeStamp = time.GetTime();
  configFileMD5.ReplaceAll(".C",Form("\_%s_%i.C",configMD5.Data(),timeStamp));

  if(gSystem->AccessPathName(configFileMD5.Data())){ // Add additional identifier if file exists
    gSystem->Exec(Form("mv %s %s",configFile.Data(),configFileMD5.Data()));
  }
  else{
    while(!gSystem->AccessPathName(configFileMD5.Data())){
      configFileMD5.ReplaceAll(".C","_1.C");
    }
    gSystem->Exec(Form("mv %s %s",configFile.Data(),configFileMD5.Data()));
  }

  TString configFilePath(configBasePath+"/"+configFileMD5);
  gROOT->LoadMacro(configFilePath.Data());
  Printf("Path of config file: %s\n",configFilePath.Data());

  // #### Task preferences
  task->SetOutputFormat(iOutput);
  task->SetLCAnalysis(isLCAnalysis);
  task->SetIsoConeRadius(iIsoConeRadius);
  task->SetEtIsoThreshold(EtIso);
  task->SetTMClusterRejection(bTMClusterRejection);
  task->SetTMClusterRejectioninCone(bTMClusterRejectionInCone);
  task->SetCTMdeltaEta(TMdeta);
  task->SetCTMdeltaPhi(TMdphi);
  task->SetCTMdeltaEtaIso(TMdetaIso);
  task->SetCTMdeltaPhiIso(TMdphiIso);
  task->SetQA(isQA);
  task->SetIsoMethod(iIsoMethod);
  task->SetEtIsoMethod(iEtIsoMethod);
  task->SetUEMethod(iUEMethod);
  task->SetUSEofTPC(bUseofTPC);
  task->SetMC(bIsMC);
  task->SetM02Smearing(iSmearingSS);
  task->SetWidth4Smear(iWidthSSsmear);
  task->SetMean4Smear(iMean_SSsmear);
  task->SetExtraIsoCuts(iExtraIsoCuts);
  task->SetAnalysispPb(i_pPb);
  task->SetNLMCut(bNLMCut,NLMCut,minNLM);
  task->SetPtBinning(ptBin);
  task->SetM02Binning(M02Bin);
  task->SetEtisoBinning(EtisoBin);
  task->SetEtueBinning(EtueBin);
  task->SetEtaBinning(EtaBin);
  task->SetPhiBinning(PhiBin);
  task->SetLabelBinning(LabelBin);
  task->SetPDGBinning(PDGBin);
  task->SetMomPDGBinning(MomPDGBin);
  task->SetClustPDGBinning(ClustPDGBin);
  task->SetDxBinning(DxBin);
  task->SetDzBinning(DzBin);
  task->SetDecayBinning(DecayBin);
  task->SetSmearForClusters(bWhichToSmear);
  task->SetNeedEmcalGeom(kTRUE);
  task->SetMCtruth(bmcTruth);
  task->SetPeriod(periodstr);
  task->SetRejectPileUpEvent(RejectPileUpEvent);
  task->SetNcontributorsToPileUp(NContrToPileUp);

  if(bIsMC && bMCNormalization) task->SetIsPythia(kTRUE);

  TString name(Form("PhotonIsolation_%s_%s", trackName.Data(), clusName.Data()));
  cout<<"Name of the container "<<name.Data()<<endl;

  // Tracks to be used for the track matching (already used in TM task, TPC only tracks)
  AliTrackContainer *trackCont = task->AddTrackContainer(trackName);
  if(!trackCont) Printf("Error with TPC-Only Tracks!!");
  trackCont->SetName("tpconlyMatch");
  trackCont->SetTrackFilterType(AliEmcalTrackSelection::kTPCOnlyTracks);

  // Tracks to be used in the analysis (Hybrid Tracks)
  AliTrackContainer * tracksForAnalysis = task->AddTrackContainer(trackName);
  if(!tracksForAnalysis) Printf("Error with Hybrids Tracks!!");
  tracksForAnalysis->SetName("filterTracksAna");
  tracksForAnalysis->SetFilterHybridTracks(kTRUE);
  if(!bIsMC){
    tracksForAnalysis->SetTrackCutsPeriod(periodstr);
    tracksForAnalysis->SetDefTrackCutsPeriod(periodstr);
  }

  // Clusters to be used in the analysis (already filtered)
  AliClusterContainer *clusterCont = task->AddClusterContainer(clusName);

  Printf("Name of track container for matching: %s \nName of track container for isolation: %s \nName of cluster container: %s",trackCont->GetName(),tracksForAnalysis->GetName(),clusterCont->GetName());

  // #### Add analysis task
  Printf("Task for neutral cluster analysis created and configured, pass it to AnalysisManager\n");
  manager->AddTask(task);

  AliAnalysisDataContainer *contHistos = manager->CreateContainer(myContName.Data(), TList::Class(), AliAnalysisManager::kOutputContainer,Form("%s:NeutralClusters",AliAnalysisManager::GetCommonFileName()));

  AliAnalysisDataContainer *cinput = manager->GetCommonInputContainer();
  manager->ConnectInput(task, 0, cinput);
  manager->ConnectOutput(task, 1, contHistos);

  return task;
}
<commit_msg>Adding pileUp option to container name<commit_after>  ///////////////////////////////////////////////////////////////////////////
  ///\file AddTaskEMCALPhotonIsolation.C
  ///\brief Configuration of AliAnalysisTaskEMCALPhotonIsolation
  ///
  /// Version to be used in lego train for testing on pp@7TeV
  ///
  /// \author Lucile Ronflette <lucile.ronflette@cern.ch>, SUBATECH, Nantes
  /// \author Davide Francesco Lodato <davide.francesco.lodato@cern.ch>, Utrecht University
  /// \author Marco Marquard <marco.marquard@cern.ch>, University Frankfurt am Main
  ///////////////////////////////////////////////////////////////////////////

AliAnalysisTaskEMCALPhotonIsolation* AddTaskEMCALPhotonIsolation(
                                                                 const char*            periodstr                 = "LHC11c",
                                                                 const char*            ntracks                   = "EmcalTracks",
                                                                 const char*            nclusters                 = "EmcCaloClusters",
                                                                 const UInt_t           pSel                      = AliVEvent::kEMC7,
                                                                 const TString          dType                     = "ESD",
                                                                 const Bool_t	        bHisto                    = kTRUE,
                                                                 const Int_t	        iOutput	  	          = 0,
                                                                 const Bool_t	        bIsMC  	                  = kFALSE,
                                                                 const Bool_t           bMCNormalization          = kFALSE,
                                                                 const Bool_t           bNLMCut                   = kFALSE,
                                                                 const Int_t            NLMCut                    = 0,
                                                                 const Double_t         minPtCutCluster           = 0.3,
                                                                 const Double_t         EtIso                     = 2.,
                                                                 const Int_t            iIsoMethod                = 1,
                                                                 const Int_t            iEtIsoMethod              = 0,
                                                                 const Int_t            iUEMethod                 = 1,
                                                                 const Bool_t           bUseofTPC                 = kFALSE,
                                                                 const Double_t         TMdeta                    = 0.02,
                                                                 const Double_t         TMdphi                    = 0.03,
                                                                 const Bool_t           bTMClusterRejection       = kTRUE,
                                                                 const Bool_t           bTMClusterRejectionInCone = kTRUE,
                                                                 const Float_t          iIsoConeRadius            = 0.4,
                                                                 const Bool_t           iSmearingSS               = kFALSE,
                                                                 const Float_t          iWidthSSsmear             = 0.,
                                                                 const Float_t          iMean_SSsmear             = 0.,
                                                                 const Bool_t           iExtraIsoCuts             = kFALSE,
                                                                 const Bool_t           i_pPb                     = kFALSE,
                                                                 const Bool_t           isQA                      = kFALSE,
                                                                 TString                configBasePath            = "",
                                                                 const Int_t            bWhichToSmear             = 0,
                                                                 const Int_t            minNLM                    = 1,
                                                                 const Double_t         TMdetaIso                 = 0.02,
                                                                 const Double_t         TMdphiIso                 = 0.03,
                                                                 const Bool_t           bmcTruth                  = kTRUE,
                                                                 const Bool_t           isLCAnalysis              = kFALSE,
                                                                 TString                L1triggerName             = "",
                                                                 const Bool_t           RejectPileUpEvent        = kFALSE,
                                                                 const Int_t            NContrToPileUp           = 3
                                                                 )
{
  Printf("Preparing neutral cluster analysis\n");

  // #### Define manager and data container names
  AliAnalysisManager *manager = AliAnalysisManager::GetAnalysisManager();
  if(!manager){
    ::Error("AddTaskEMCALPhotonIsolation", "No analysis manager to connect to.");
    return NULL;
  }

  // Use the input containers naming convention with "usedefault" (already used in several EMCal tasks and new correction framework)
  TString trackName(ntracks);
  TString clusName(nclusters);

  if(trackName == "usedefault"){
    if(dType == "ESD"){
      trackName = "Tracks";
    }
    else if(dType == "AOD"){
      trackName = "tracks";
    }
    else{
      trackName = "";
    }
  }

  if(clusName == "usedefault"){
    if(dType == "ESD"){
      clusName = "CaloClusters";
    }
    else if(dType == "AOD"){
      clusName = "caloClusters";
    }
    else{
      clusName = "";
    }
  }

  // Set the task output container name
  Printf("Creating container name for cluster analysis\n");

  TString myContName("");
  if(bIsMC){
    myContName = Form("Analysis_Neutrals_MC");
  }
  else{
    myContName = Form("Analysis_Neutrals");
  }

  if(L1triggerName.Contains("EG1") || L1triggerName.Contains("EGA1")){
    L1triggerName = "EG1";
  }
  else if(L1triggerName.Contains("EG2") || L1triggerName.Contains("EGA2")){
    L1triggerName = "EG2";
  }
  else{
    L1triggerName = "";
  }
  TString pileUp;
  if(RejectPileUpEvent){
    pileUp=Form("_PU_ON%d",NContrToPileUp);
  }
  else{
    pileUp="";
  }

  if(L1triggerName != ""){
    myContName.Append(Form("%s_TM_%s_CPVe%.2lf_CPVp%.2lf_IsoMet%d_EtIsoMet%d_UEMet%d_TPCbound_%s_IsoConeR%.1f_NLMCut_%s_minNLM%d_maxNLM%d_SSsmear_%s_Width%.3f_Mean_%.3f_PureIso_%s_WhichSmear_%d_Trigger_%s%s",isLCAnalysis?"_LC_Yes":"",bTMClusterRejection? "On" :"Off", TMdeta , TMdphi ,iIsoMethod,iEtIsoMethod,iUEMethod,bUseofTPC ? "Yes" : "No",iIsoConeRadius,bNLMCut ? "On": "Off",minNLM, NLMCut, iSmearingSS ? "On":"Off",iWidthSSsmear,iMean_SSsmear,iExtraIsoCuts?"On":"Off",bWhichToSmear,L1triggerName.Data(),pileUp.Data()));
  }
  else{
    myContName.Append(Form("%s_TM_%s_CPVe%.2lf_CPVp%.2lf_IsoMet%d_EtIsoMet%d_UEMet%d_TPCbound_%s_IsoConeR%.1f_NLMCut_%s_minNLM%d_maxNLM%d_SSsmear_%s_Width%.3f_Mean_%.3f_PureIso_%s_WhichSmear_%d%s",isLCAnalysis?"_LC_Yes":"",bTMClusterRejection? "On" :"Off", TMdeta , TMdphi ,iIsoMethod,iEtIsoMethod,iUEMethod,bUseofTPC ? "Yes" : "No",iIsoConeRadius,bNLMCut ? "On": "Off",minNLM, NLMCut, iSmearingSS ? "On":"Off",iWidthSSsmear,iMean_SSsmear,iExtraIsoCuts?"On":"Off",bWhichToSmear,pileUp.Data()));
  }

  // #### Define analysis task
  AliAnalysisTaskEMCALPhotonIsolation* task = new AliAnalysisTaskEMCALPhotonIsolation("Analysis",bHisto);

  TString configFile("config_PhotonIsolation.C"); // Name of config file
  //  if(gSystem->AccessPathName(configFile.Data())){ // Check for exsisting file and delete it
  //    gSystem->Exec(Form("rm %s",configFile.Data()));
  //  }

  if(configBasePath.IsNull()){ // Check if a specific config should be used and copy appropriate file
    configBasePath="$ALICE_PHYSICS/PWGGA/EMCALTasks/macros";
    gSystem->Exec(Form("cp %s/%s .",configBasePath.Data(),configFile.Data()));
  }
  else if(configBasePath.Contains("alien:///")){
    gSystem->Exec(Form("alien_cp %s/%s .",configBasePath.Data(),configFile.Data()));
  }
  else{
    gSystem->Exec(Form("cp %s/%s .",configBasePath.Data(),configFile.Data()));
  }

  configBasePath=Form("%s/",gSystem->pwd());
  ifstream configIn; // Open config file for hash calculation
  configIn.open(configFile);
  TString configStr;
  configStr.ReadFile(configIn);
  TString configMD5 = configStr.MD5();
  configMD5.Resize(5); // Short hash value for usable extension
  TString configFileMD5 = configFile;
  TDatime time; // Get timestamp
  Int_t timeStamp = time.GetTime();
  configFileMD5.ReplaceAll(".C",Form("\_%s_%i.C",configMD5.Data(),timeStamp));

  if(gSystem->AccessPathName(configFileMD5.Data())){ // Add additional identifier if file exists
    gSystem->Exec(Form("mv %s %s",configFile.Data(),configFileMD5.Data()));
  }
  else{
    while(!gSystem->AccessPathName(configFileMD5.Data())){
      configFileMD5.ReplaceAll(".C","_1.C");
    }
    gSystem->Exec(Form("mv %s %s",configFile.Data(),configFileMD5.Data()));
  }

  TString configFilePath(configBasePath+"/"+configFileMD5);
  gROOT->LoadMacro(configFilePath.Data());
  Printf("Path of config file: %s\n",configFilePath.Data());

  // #### Task preferences
  task->SetOutputFormat(iOutput);
  task->SetLCAnalysis(isLCAnalysis);
  task->SetIsoConeRadius(iIsoConeRadius);
  task->SetEtIsoThreshold(EtIso);
  task->SetTMClusterRejection(bTMClusterRejection);
  task->SetTMClusterRejectioninCone(bTMClusterRejectionInCone);
  task->SetCTMdeltaEta(TMdeta);
  task->SetCTMdeltaPhi(TMdphi);
  task->SetCTMdeltaEtaIso(TMdetaIso);
  task->SetCTMdeltaPhiIso(TMdphiIso);
  task->SetQA(isQA);
  task->SetIsoMethod(iIsoMethod);
  task->SetEtIsoMethod(iEtIsoMethod);
  task->SetUEMethod(iUEMethod);
  task->SetUSEofTPC(bUseofTPC);
  task->SetMC(bIsMC);
  task->SetM02Smearing(iSmearingSS);
  task->SetWidth4Smear(iWidthSSsmear);
  task->SetMean4Smear(iMean_SSsmear);
  task->SetExtraIsoCuts(iExtraIsoCuts);
  task->SetAnalysispPb(i_pPb);
  task->SetNLMCut(bNLMCut,NLMCut,minNLM);
  task->SetPtBinning(ptBin);
  task->SetM02Binning(M02Bin);
  task->SetEtisoBinning(EtisoBin);
  task->SetEtueBinning(EtueBin);
  task->SetEtaBinning(EtaBin);
  task->SetPhiBinning(PhiBin);
  task->SetLabelBinning(LabelBin);
  task->SetPDGBinning(PDGBin);
  task->SetMomPDGBinning(MomPDGBin);
  task->SetClustPDGBinning(ClustPDGBin);
  task->SetDxBinning(DxBin);
  task->SetDzBinning(DzBin);
  task->SetDecayBinning(DecayBin);
  task->SetSmearForClusters(bWhichToSmear);
  task->SetNeedEmcalGeom(kTRUE);
  task->SetMCtruth(bmcTruth);
  task->SetPeriod(periodstr);
  task->SetRejectPileUpEvent(RejectPileUpEvent);
  task->SetNcontributorsToPileUp(NContrToPileUp);

  if(bIsMC && bMCNormalization) task->SetIsPythia(kTRUE);

  TString name(Form("PhotonIsolation_%s_%s", trackName.Data(), clusName.Data()));
  cout<<"Name of the container "<<name.Data()<<endl;

  // Tracks to be used for the track matching (already used in TM task, TPC only tracks)
  AliTrackContainer *trackCont = task->AddTrackContainer(trackName);
  if(!trackCont) Printf("Error with TPC-Only Tracks!!");
  trackCont->SetName("tpconlyMatch");
  trackCont->SetTrackFilterType(AliEmcalTrackSelection::kTPCOnlyTracks);

  // Tracks to be used in the analysis (Hybrid Tracks)
  AliTrackContainer * tracksForAnalysis = task->AddTrackContainer(trackName);
  if(!tracksForAnalysis) Printf("Error with Hybrids Tracks!!");
  tracksForAnalysis->SetName("filterTracksAna");
  tracksForAnalysis->SetFilterHybridTracks(kTRUE);
  if(!bIsMC){
    tracksForAnalysis->SetTrackCutsPeriod(periodstr);
    tracksForAnalysis->SetDefTrackCutsPeriod(periodstr);
  }

  // Clusters to be used in the analysis (already filtered)
  AliClusterContainer *clusterCont = task->AddClusterContainer(clusName);

  Printf("Name of track container for matching: %s \nName of track container for isolation: %s \nName of cluster container: %s",trackCont->GetName(),tracksForAnalysis->GetName(),clusterCont->GetName());

  // #### Add analysis task
  Printf("Task for neutral cluster analysis created and configured, pass it to AnalysisManager\n");
  manager->AddTask(task);

  AliAnalysisDataContainer *contHistos = manager->CreateContainer(myContName.Data(), TList::Class(), AliAnalysisManager::kOutputContainer,Form("%s:NeutralClusters",AliAnalysisManager::GetCommonFileName()));

  AliAnalysisDataContainer *cinput = manager->GetCommonInputContainer();
  manager->ConnectInput(task, 0, cinput);
  manager->ConnectOutput(task, 1, contHistos);

  return task;
}
<|endoftext|>


<commit_before><commit_msg>Fix new cov matrix name<commit_after><|endoftext|>


<commit_before>/*
 * This source file is part of libRocket, the HTML/CSS Interface Middleware
 *
 * For the latest information, see http://www.librocket.com
 *
 * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 *
 */
#pragma once

#include "LibRocketEventManagerSystem.h"
#include <Rocket/Core/Context.h>
#include <Rocket/Core/ElementDocument.h>
#include <Rocket/Core/ElementUtilities.h>
//#include <Shell.h>
#include "EventHandler.h"
#include "EventInstancer.h"
//#include "GameDetails.h"
#include <map>
#include <Globals.h>
#include <ToString.h>
#include <DebugUtil.h>
#include "libRocketBackendSystem.h"

LibRocketEventManagerSystem::LibRocketEventManagerSystem()
	: EntitySystem(SystemType::LibRocketEventManagerSystem)
{
	m_context = NULL;
	wantsToExit = false;
	m_eventHandler = NULL;
	m_currentDocId = "";
}

LibRocketEventManagerSystem::~LibRocketEventManagerSystem()
{
	shutdown();
}

void LibRocketEventManagerSystem::initialize()
{
	auto rocketBackend = static_cast<LibRocketBackendSystem*>(
		m_world->getSystem(SystemType::LibRocketBackendSystem));

	m_context = rocketBackend->getContext();

	EventInstancer* eventInstancer = new EventInstancer(this);
	Rocket::Core::Factory::RegisterEventListenerInstancer(eventInstancer);
	eventInstancer->RemoveReference();
}

// Releases all event handlers registered with the manager.
void LibRocketEventManagerSystem::shutdown()
{
	//for (EventHandlerMap::iterator i = event_handlers.begin(); i != event_handlers.end(); ++i)
	//	delete (*i).second;

	m_eventHandlers.clear();
	m_eventHandler = NULL;
}

void LibRocketEventManagerSystem::registerEventHandler( EventHandler* p_handler )
{
	registerEventHandler(p_handler->getName().c_str(), p_handler);
}

// Registers a new event handler with the manager.
void LibRocketEventManagerSystem::registerEventHandler(const Rocket::Core::String& p_handlerName, EventHandler* p_handler)
{
	p_handler->connectToManager(this);
	// Release any handler bound under the same name.
	EventHandlerMap::iterator iterator = m_eventHandlers.find(p_handlerName);
	if (iterator != m_eventHandlers.end())
	{	//delete (*iterator).second;
		DEBUGWARNING(((
			toString("LibRocketEventManagerSystem::registerEventHandler\nAttempting to register EventHandler[")
			+ toString(p_handlerName.CString())
			+ toString("] which has already been registred in the EventManager.")).c_str()));
	}
	m_eventHandlers[p_handlerName] = p_handler;
}

EventHandler* LibRocketEventManagerSystem::unregisterEventHandler( const Rocket::Core::String& p_handlerName )
{
	EventHandlerMap::iterator iterator = m_eventHandlers.find(p_handlerName);
	EventHandler* handler = NULL;
	if (iterator != m_eventHandlers.end())
	{
		handler = (*iterator).second;
		handler->connectToManager(NULL);
		m_eventHandlers[p_handlerName] = NULL;
	}
	return handler;
}

void LibRocketEventManagerSystem::clearDocumentStack()
{
	while (!m_docIdStack.empty())
	{
		auto document = m_context->GetDocument(m_docIdStack.top());
		m_docIdStack.pop();
		if (document->IsVisible())
			document->Hide();
	}
	m_currentDocId = "";
}

// Processes an event coming through from Rocket.
void LibRocketEventManagerSystem::processEvent(Rocket::Core::Event& p_event, const Rocket::Core::String& p_value)
{
	Rocket::Core::StringList commands;
	Rocket::Core::StringUtilities::ExpandString(commands, p_value, ';');
	for (size_t i = 0; i < commands.size(); ++i)
	{
		// Check for a generic 'load', 'exit' or 'modal' command.
		Rocket::Core::StringList values;
		Rocket::Core::StringUtilities::ExpandString(values, commands[i], ' ');

		if (values.empty())
			return;

		auto ownerDocument = p_event.GetTargetElement()->GetOwnerDocument();
		if (values[0] == "modal")
		{
			if (!ownerDocument->IsModal() && m_currentDocId == ownerDocument->GetId())
				ownerDocument->Show(Rocket::Core::ElementDocument::MODAL);
		}
		else if (values[0] == "goto" && values.size() > 1)
		{
			// Clear the stack from windows that are on top of the triggering one.
			clearStackUntilFoundDocId(ownerDocument->GetId());
			// If goto previous is specified, then hide this window, and open the
			// previous one saved on the stack
			if (values[1] == "previous")
			{
				// Pop current document id from the stack.
				m_docIdStack.pop();
				// Top and pop next document id. On loadWindow, it will be added again.
				// That's not pretty/efficient, but it isn't a problem either. // Alex
				Rocket::Core::String window = m_docIdStack.top();
				m_docIdStack.pop();
				if (loadWindow(window))
					ownerDocument->Hide();
			}
			// Load the window, and if successful hide the old window.
			else if (loadWindow(values[1]))
			{
				ownerDocument->Hide();
			}
		}
		else if (values[0] == "open" &&	values.size() > 1)
		{
			// Opens a window and pushes it to the stack, without hiding the parent window.
			// Clear other open windows on top.
			clearStackUntilFoundDocId(ownerDocument->GetId());
			loadWindow(values[1]);
			ownerDocument->Show(Rocket::Core::ElementDocument::NONE);
		}

		else if (values[0] == "exit")
		{
			wantsToExit = true;
		}
		else
		{
			if (m_eventHandler != NULL)
				m_eventHandler->processEvent(p_event, commands[i]);
		}
	}
}

// Loads a window and binds the event handler for it.
bool LibRocketEventManagerSystem::loadWindow(const Rocket::Core::String& p_windowName)
{
	// Set the event handler for the new screen, if one has been registered.
	EventHandler* old_event_handler = m_eventHandler;
	EventHandlerMap::iterator iterator = m_eventHandlers.find(p_windowName);
	if (iterator != m_eventHandlers.end())
		m_eventHandler = (*iterator).second;
	else
		m_eventHandler = NULL;

	auto document = m_context->GetDocument(p_windowName);
	if (document == NULL)
	{
		DEBUGWARNING(((
			toString("LibRocketEventManagerSystem::loadWindow\nNo document with the body id\"")
			+ toString(p_windowName.CString())
			+ toString("\" has been loaded.")).c_str()));
		m_eventHandler = old_event_handler;
		return false;
	}

	// Add this document to the stack!
	m_currentDocId = p_windowName;
	m_docIdStack.push(p_windowName);

	document->Show();
	document->PullToFront();

	// Remove the caller's reference.
	//document->RemoveReference();

	return true;
}

void LibRocketEventManagerSystem::process()
{
	if (wantsToExit)
		m_world->requestToShutDown();
}

void LibRocketEventManagerSystem::clearStackUntilFoundDocId( const Rocket::Core::String&  p_docId )
{
	while (m_docIdStack.top() != p_docId)
	{
		auto document = m_context->GetDocument(m_docIdStack.top());
		m_docIdStack.pop();
		if (document->IsVisible())
			document->Hide();
	}
}
<commit_msg>ISSUE FIX: Fixed so that the menu becomes unfocused after being hidden, and doesn't trigger librocket events.<commit_after>/*
 * This source file is part of libRocket, the HTML/CSS Interface Middleware
 *
 * For the latest information, see http://www.librocket.com
 *
 * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 *
 */
#pragma once

#include "LibRocketEventManagerSystem.h"
#include <Rocket/Core/Context.h>
#include <Rocket/Core/ElementDocument.h>
#include <Rocket/Core/ElementUtilities.h>
//#include <Shell.h>
#include "EventHandler.h"
#include "EventInstancer.h"
//#include "GameDetails.h"
#include <map>
#include <Globals.h>
#include <ToString.h>
#include <DebugUtil.h>
#include "libRocketBackendSystem.h"

LibRocketEventManagerSystem::LibRocketEventManagerSystem()
	: EntitySystem(SystemType::LibRocketEventManagerSystem)
{
	m_context = NULL;
	wantsToExit = false;
	m_eventHandler = NULL;
	m_currentDocId = "";
}

LibRocketEventManagerSystem::~LibRocketEventManagerSystem()
{
	shutdown();
}

void LibRocketEventManagerSystem::initialize()
{
	auto rocketBackend = static_cast<LibRocketBackendSystem*>(
		m_world->getSystem(SystemType::LibRocketBackendSystem));

	m_context = rocketBackend->getContext();

	EventInstancer* eventInstancer = new EventInstancer(this);
	Rocket::Core::Factory::RegisterEventListenerInstancer(eventInstancer);
	eventInstancer->RemoveReference();
}

// Releases all event handlers registered with the manager.
void LibRocketEventManagerSystem::shutdown()
{
	//for (EventHandlerMap::iterator i = event_handlers.begin(); i != event_handlers.end(); ++i)
	//	delete (*i).second;

	m_eventHandlers.clear();
	m_eventHandler = NULL;
}

void LibRocketEventManagerSystem::registerEventHandler( EventHandler* p_handler )
{
	registerEventHandler(p_handler->getName().c_str(), p_handler);
}

// Registers a new event handler with the manager.
void LibRocketEventManagerSystem::registerEventHandler(const Rocket::Core::String& p_handlerName, EventHandler* p_handler)
{
	p_handler->connectToManager(this);
	// Release any handler bound under the same name.
	EventHandlerMap::iterator iterator = m_eventHandlers.find(p_handlerName);
	if (iterator != m_eventHandlers.end())
	{	//delete (*iterator).second;
		DEBUGWARNING(((
			toString("LibRocketEventManagerSystem::registerEventHandler\nAttempting to register EventHandler[")
			+ toString(p_handlerName.CString())
			+ toString("] which has already been registred in the EventManager.")).c_str()));
	}
	m_eventHandlers[p_handlerName] = p_handler;
}

EventHandler* LibRocketEventManagerSystem::unregisterEventHandler( const Rocket::Core::String& p_handlerName )
{
	EventHandlerMap::iterator iterator = m_eventHandlers.find(p_handlerName);
	EventHandler* handler = NULL;
	if (iterator != m_eventHandlers.end())
	{
		handler = (*iterator).second;
		handler->connectToManager(NULL);
		m_eventHandlers[p_handlerName] = NULL;
	}
	return handler;
}

void LibRocketEventManagerSystem::clearDocumentStack()
{
	while (!m_docIdStack.empty())
	{
		auto document = m_context->GetDocument(m_docIdStack.top());
		m_docIdStack.pop();
		if (document->IsVisible())
		{
			document->Show(Rocket::Core::ElementDocument::NONE);
			document->Hide();
		}
	}

	m_currentDocId = "";
}

// Processes an event coming through from Rocket.
void LibRocketEventManagerSystem::processEvent(Rocket::Core::Event& p_event, const Rocket::Core::String& p_value)
{
	Rocket::Core::StringList commands;
	Rocket::Core::StringUtilities::ExpandString(commands, p_value, ';');
	for (size_t i = 0; i < commands.size(); ++i)
	{
		// Check for a generic 'load', 'exit' or 'modal' command.
		Rocket::Core::StringList values;
		Rocket::Core::StringUtilities::ExpandString(values, commands[i], ' ');

		if (values.empty())
			return;

		auto ownerDocument = p_event.GetTargetElement()->GetOwnerDocument();
		if (values[0] == "modal")
		{
			if (!ownerDocument->IsModal() && m_currentDocId == ownerDocument->GetId())
				ownerDocument->Show(Rocket::Core::ElementDocument::MODAL);
		}
		else if (values[0] == "goto" && values.size() > 1)
		{
			// Clear the stack from windows that are on top of the triggering one.
			clearStackUntilFoundDocId(ownerDocument->GetId());
			// If goto previous is specified, then hide this window, and open the
			// previous one saved on the stack
			if (values[1] == "previous")
			{
				// Pop current document id from the stack.
				m_docIdStack.pop();
				// Top and pop next document id. On loadWindow, it will be added again.
				// That's not pretty/efficient, but it isn't a problem either. // Alex
				Rocket::Core::String window = m_docIdStack.top();
				m_docIdStack.pop();
				if (loadWindow(window))
					ownerDocument->Hide();
			}
			// Load the window, and if successful hide the old window.
			else if (loadWindow(values[1]))
			{
				ownerDocument->Hide();
			}
		}
		else if (values[0] == "open" &&	values.size() > 1)
		{
			// Opens a window and pushes it to the stack, without hiding the parent window.
			// Clear other open windows on top.
			clearStackUntilFoundDocId(ownerDocument->GetId());
			loadWindow(values[1]);
			ownerDocument->Show(Rocket::Core::ElementDocument::NONE);
		}

		else if (values[0] == "exit")
		{
			wantsToExit = true;
		}
		else
		{
			if (m_eventHandler != NULL)
				m_eventHandler->processEvent(p_event, commands[i]);
		}
	}
}

// Loads a window and binds the event handler for it.
bool LibRocketEventManagerSystem::loadWindow(const Rocket::Core::String& p_windowName)
{
	// Set the event handler for the new screen, if one has been registered.
	EventHandler* old_event_handler = m_eventHandler;
	EventHandlerMap::iterator iterator = m_eventHandlers.find(p_windowName);
	if (iterator != m_eventHandlers.end())
		m_eventHandler = (*iterator).second;
	else
		m_eventHandler = NULL;

	auto document = m_context->GetDocument(p_windowName);
	if (document == NULL)
	{
		DEBUGWARNING(((
			toString("LibRocketEventManagerSystem::loadWindow\nNo document with the body id\"")
			+ toString(p_windowName.CString())
			+ toString("\" has been loaded.")).c_str()));
		m_eventHandler = old_event_handler;
		return false;
	}

	// Add this document to the stack!
	m_currentDocId = p_windowName;
	m_docIdStack.push(p_windowName);

	document->Show();
	document->PullToFront();

	// Remove the caller's reference.
	//document->RemoveReference();

	return true;
}

void LibRocketEventManagerSystem::process()
{
	if (wantsToExit)
		m_world->requestToShutDown();
}

void LibRocketEventManagerSystem::clearStackUntilFoundDocId( const Rocket::Core::String&  p_docId )
{
	while (m_docIdStack.top() != p_docId)
	{
		auto document = m_context->GetDocument(m_docIdStack.top());
		m_docIdStack.pop();
		if (document->IsVisible())
		{
			document->Show(Rocket::Core::ElementDocument::NONE);
			document->Hide();
		}
	}
}
<|endoftext|>


<commit_before>/*
 * Copyright (C) 2005-2017 Centre National d'Etudes Spatiales (CNES)
 *
 * This file is part of Orfeo Toolbox
 *
 *     https://www.orfeo-toolbox.org/
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef otbGenericRSTransform_hxx
#define otbGenericRSTransform_hxx

#include "otbGenericRSTransform.h"
#include "otbMacro.h"
#include "otbMetaDataKey.h"
#include "itkMetaDataObject.h"

#include "otbSpatialReference.h"

#include "ogr_spatialref.h"

namespace otb
{

template<class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions>
GenericRSTransform<TScalarType, NInputDimensions, NOutputDimensions>
::GenericRSTransform() : Superclass(0)
{
  m_InputProjectionRef.clear();
  m_OutputProjectionRef.clear();
  m_InputKeywordList.Clear();
  m_OutputKeywordList.Clear();
  m_InputSpacing.Fill(1);
  m_InputOrigin.Fill(0);
  m_OutputSpacing.Fill(1);
  m_OutputOrigin.Fill(0);

  m_Transform = nullptr;
  m_InputTransform = nullptr;
  m_OutputTransform = nullptr;
  m_TransformUpToDate = false;
  m_TransformAccuracy = Projection::UNKNOWN;
}

template<class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions>
const typename GenericRSTransform<TScalarType, NInputDimensions, NOutputDimensions>::TransformType*
GenericRSTransform<TScalarType, NInputDimensions, NOutputDimensions>
::GetTransform() const
{
  itkDebugMacro("returning MapProjection address " << this->m_Transform);
  if ((!m_TransformUpToDate) || (m_Transform.IsNull()))
    {
    itkExceptionMacro(<< "m_Transform not up-to-date, call InstantiateTransform() first");
    }

  return this->m_Transform;
}

/**
 * Instantiate the transformation according to information
 */
template<class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions>
void
GenericRSTransform<TScalarType, NInputDimensions, NOutputDimensions>
::InstantiateTransform(void)
{
  m_Transform = TransformType::New();

  if (m_InputKeywordList.GetSize()  == 0)
    {
    itk::ExposeMetaData<ImageKeywordlist>(m_InputDictionary, MetaDataKey::OSSIMKeywordlistKey, m_InputKeywordList);
    }
  if (m_InputProjectionRef.empty())
    {
    itk::ExposeMetaData<std::string>(m_InputDictionary, MetaDataKey::ProjectionRefKey, m_InputProjectionRef);
    }

  otbMsgDevMacro(<< "Information to instantiate transform: ");
  otbMsgDevMacro(<< " * Input Origin: " << m_InputOrigin);
  otbMsgDevMacro(<< " * Input Spacing: " << m_InputSpacing);
  otbMsgDevMacro(<< " * Input keyword list: "
                 << ((m_InputKeywordList.GetSize() == 0) ? "Empty" : "Full"));
  otbMsgDevMacro(<< " * Input projection: " << m_InputProjectionRef);
  otbMsgDevMacro(<< " * Output keyword list: "
                 << ((m_OutputKeywordList.GetSize() == 0) ? "Empty" : "Full"));
  otbMsgDevMacro(<< " * Output projection: " << m_OutputProjectionRef);
  otbMsgDevMacro(<< " * Output Origin: " << m_OutputOrigin);
  otbMsgDevMacro(<< " * Output Spacing: " << m_OutputSpacing);

  //Make sure that the state is clean:
  m_InputTransform = nullptr;
  m_OutputTransform = nullptr;

  bool inputTransformIsSensor = false;
  bool inputTransformIsMap = false;
  bool outputTransformIsSensor = false;
  bool outputTransformIsMap = false;

  m_InputProjectionRef = SpatialReference::FromDescription(m_InputProjectionRef).ToWkt();
  m_OutputProjectionRef = SpatialReference::FromDescription(m_OutputProjectionRef).ToWkt();

  //*****************************
  //Set the input transformation
  //*****************************

    // First, try to make a geo transform
  if (!m_InputProjectionRef.empty()) //map projection
    {
    typedef otb::GenericMapProjection<TransformDirection::INVERSE, ScalarType, InputSpaceDimension, InputSpaceDimension>
        InverseMapProjectionType;
    typename InverseMapProjectionType::Pointer mapTransform = InverseMapProjectionType::New();

    mapTransform->SetWkt(m_InputProjectionRef);
    if (mapTransform->IsProjectionDefined())
      {
      m_InputTransform = mapTransform.GetPointer();
      inputTransformIsMap = true;
      otbMsgDevMacro(<< "Input projection set to map transform: " << m_InputTransform);
      }
    }

  // If not, try to make a sensor model
  if ((m_InputTransform.IsNull()) && (m_InputKeywordList.GetSize() > 0))
    {
    typedef otb::ForwardSensorModel<double, InputSpaceDimension, InputSpaceDimension> ForwardSensorModelType;
    typename ForwardSensorModelType::Pointer sensorModel = ForwardSensorModelType::New();

    sensorModel->SetImageGeometry(m_InputKeywordList);

    if (sensorModel->IsValidSensorModel())
      {
      m_InputTransform = sensorModel.GetPointer();
      inputTransformIsSensor = true;
      otbMsgDevMacro(<< "Input projection set to sensor model.");
      }
    }

  if (m_InputTransform.IsNull()) //default if we didn't manage to instantiate it before
    {
    m_InputTransform = itk::IdentityTransform<double, NInputDimensions>::New();
    }

  //*****************************
  //Set the output transformation
  //*****************************
  if (!m_OutputProjectionRef.empty()) //map projection
    {
    typedef otb::GenericMapProjection<TransformDirection::FORWARD, ScalarType, InputSpaceDimension,
    OutputSpaceDimension> ForwardMapProjectionType;
    typename ForwardMapProjectionType::Pointer mapTransform = ForwardMapProjectionType::New();
    mapTransform->SetWkt(m_OutputProjectionRef);
    if (mapTransform->IsProjectionDefined())
      {
      m_OutputTransform = mapTransform.GetPointer();
      outputTransformIsMap = true;
      otbMsgDevMacro(<< "Output projection set to map transform: " << m_OutputTransform);
      }
    }

  // If not, try to make a sensor model
  if ((m_OutputTransform.IsNull()) && (m_OutputKeywordList.GetSize() > 0))
    {
    typedef otb::InverseSensorModel<double, InputSpaceDimension, OutputSpaceDimension> InverseSensorModelType;
    typename InverseSensorModelType::Pointer sensorModel = InverseSensorModelType::New();

    sensorModel->SetImageGeometry(m_OutputKeywordList);

    if (sensorModel->IsValidSensorModel())
      {
      m_OutputTransform = sensorModel.GetPointer();
      outputTransformIsSensor = true;
      otbMsgDevMacro(<< "Output projection set to sensor model");
      }
    }

  if (m_OutputTransform.IsNull()) //default if we didn't manage to instantiate it before
    {
    m_OutputTransform = itk::IdentityTransform<double, NOutputDimensions>::New();
    otbMsgDevMacro(<< "Output projection set to identity");
    }

  m_Transform->SetFirstTransform(m_InputTransform);
  m_Transform->SetSecondTransform(m_OutputTransform);
  m_TransformUpToDate = true;

  //The accuracy information is a simplistic model for now and should be refined
  if ((inputTransformIsSensor || outputTransformIsSensor))
    {
    //Sensor model
    m_TransformAccuracy = Projection::ESTIMATE;
    }
  else if (!outputTransformIsSensor && !outputTransformIsMap)
    {
    //The original image was in lon/lat and we did not change anything
    m_TransformAccuracy = Projection::PRECISE;
    }
  else if (!inputTransformIsSensor && !outputTransformIsSensor && !inputTransformIsMap && !outputTransformIsMap)
    {
    //no transform
    m_TransformAccuracy = Projection::UNKNOWN;
    }
  else
    {
    m_TransformAccuracy = Projection::PRECISE;
    }

}

template<class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions>
typename GenericRSTransform<TScalarType, NInputDimensions, NOutputDimensions>::OutputPointType
GenericRSTransform<TScalarType, NInputDimensions, NOutputDimensions>
::TransformPoint(const InputPointType& point) const
{
  InputPointType inputPoint = point;

  // Apply input origin/spacing
  inputPoint[0] = inputPoint[0] * m_InputSpacing[0] + m_InputOrigin[0];
  inputPoint[1] = inputPoint[1] * m_InputSpacing[1] + m_InputOrigin[1];

  // Transform point
  OutputPointType outputPoint;
  outputPoint = this->GetTransform()->TransformPoint(inputPoint);

  // Apply output origin/spacing
  outputPoint[0] = (outputPoint[0] - m_OutputOrigin[0]) / m_OutputSpacing[0];
  outputPoint[1] = (outputPoint[1] - m_OutputOrigin[1]) / m_OutputSpacing[1];

//  otbMsgDevMacro("GenericRSTransform: " << point << " -> " << outputPoint);

  return outputPoint;
}

template<class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions>
bool
GenericRSTransform<TScalarType, NInputDimensions, NOutputDimensions>
::GetInverse(Self * inverseTransform) const
{
  // Test the inverseTransform pointer
  if (inverseTransform == nullptr)
    {
    return false;
    }

  // Swich projection refs
  inverseTransform->SetInputProjectionRef(m_OutputProjectionRef);
  inverseTransform->SetOutputProjectionRef(m_InputProjectionRef);

  // Switch keywordlists
  inverseTransform->SetInputKeywordList(m_OutputKeywordList);
  inverseTransform->SetOutputKeywordList(m_InputKeywordList);

  // Switch dictionnaries
  inverseTransform->SetInputDictionary(m_OutputDictionary);
  inverseTransform->SetOutputDictionary(m_InputDictionary);

  // Switch spacings
  inverseTransform->SetInputSpacing(m_OutputSpacing);
  inverseTransform->SetOutputSpacing(m_InputSpacing);

  // Switch origins
  inverseTransform->SetInputOrigin(m_OutputOrigin);
  inverseTransform->SetOutputOrigin(m_InputOrigin);

  // Instantiate transform
  inverseTransform->InstantiateTransform();

  return true;
}

template<class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions>
typename GenericRSTransform<TScalarType, NInputDimensions, NOutputDimensions>
::InverseTransformBasePointer
GenericRSTransform<TScalarType, NInputDimensions, NOutputDimensions>
::GetInverseTransform() const
{
  Self * inverseTransform = Self::New();

  bool success = this->GetInverse(inverseTransform);

  if (!success)
    {
    itkExceptionMacro(<< "Failed to create inverse transform");
    }

  return inverseTransform;
}

template<class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions>
void
GenericRSTransform<TScalarType, NInputDimensions, NOutputDimensions>
::PrintSelf(std::ostream& os, itk::Indent indent) const
{
  Superclass::PrintSelf(os, indent);
  os << indent << "Up to date: " << m_TransformUpToDate << std::endl;
  if (m_TransformUpToDate)
    {
    os << indent << "Input transform: "<< std::endl;
    m_InputTransform->Print(os, indent.GetNextIndent());
    os << indent << "Output transform: " << std::endl;
    m_OutputTransform->Print(os, indent.GetNextIndent());
    }
  else
    {
    os << indent << "Input transform: NULL" << std::endl;
    os << indent << "Output transform: NULL" << std::endl;
    }
  os << indent << "Accuracy: "
      << (m_TransformAccuracy == Projection::PRECISE ?
                "PRECISE" : (m_TransformAccuracy == Projection::ESTIMATE ?
                                  "ESTIMATE" : "UNKNOWN")) << std::endl;
}

} // namespace otb

#endif
<commit_msg>ENH: Remove undesired conversion that is triggering an exception<commit_after>/*
 * Copyright (C) 2005-2017 Centre National d'Etudes Spatiales (CNES)
 *
 * This file is part of Orfeo Toolbox
 *
 *     https://www.orfeo-toolbox.org/
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef otbGenericRSTransform_hxx
#define otbGenericRSTransform_hxx

#include "otbGenericRSTransform.h"
#include "otbMacro.h"
#include "otbMetaDataKey.h"
#include "itkMetaDataObject.h"

#include "otbSpatialReference.h"

#include "ogr_spatialref.h"

namespace otb
{

template<class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions>
GenericRSTransform<TScalarType, NInputDimensions, NOutputDimensions>
::GenericRSTransform() : Superclass(0)
{
  m_InputProjectionRef.clear();
  m_OutputProjectionRef.clear();
  m_InputKeywordList.Clear();
  m_OutputKeywordList.Clear();
  m_InputSpacing.Fill(1);
  m_InputOrigin.Fill(0);
  m_OutputSpacing.Fill(1);
  m_OutputOrigin.Fill(0);

  m_Transform = nullptr;
  m_InputTransform = nullptr;
  m_OutputTransform = nullptr;
  m_TransformUpToDate = false;
  m_TransformAccuracy = Projection::UNKNOWN;
}

template<class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions>
const typename GenericRSTransform<TScalarType, NInputDimensions, NOutputDimensions>::TransformType*
GenericRSTransform<TScalarType, NInputDimensions, NOutputDimensions>
::GetTransform() const
{
  itkDebugMacro("returning MapProjection address " << this->m_Transform);
  if ((!m_TransformUpToDate) || (m_Transform.IsNull()))
    {
    itkExceptionMacro(<< "m_Transform not up-to-date, call InstantiateTransform() first");
    }

  return this->m_Transform;
}

/**
 * Instantiate the transformation according to information
 */
template<class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions>
void
GenericRSTransform<TScalarType, NInputDimensions, NOutputDimensions>
::InstantiateTransform(void)
{
  m_Transform = TransformType::New();

  if (m_InputKeywordList.GetSize()  == 0)
    {
    itk::ExposeMetaData<ImageKeywordlist>(m_InputDictionary, MetaDataKey::OSSIMKeywordlistKey, m_InputKeywordList);
    }
  if (m_InputProjectionRef.empty())
    {
    itk::ExposeMetaData<std::string>(m_InputDictionary, MetaDataKey::ProjectionRefKey, m_InputProjectionRef);
    }

  otbMsgDevMacro(<< "Information to instantiate transform: ");
  otbMsgDevMacro(<< " * Input Origin: " << m_InputOrigin);
  otbMsgDevMacro(<< " * Input Spacing: " << m_InputSpacing);
  otbMsgDevMacro(<< " * Input keyword list: "
                 << ((m_InputKeywordList.GetSize() == 0) ? "Empty" : "Full"));
  otbMsgDevMacro(<< " * Input projection: " << m_InputProjectionRef);
  otbMsgDevMacro(<< " * Output keyword list: "
                 << ((m_OutputKeywordList.GetSize() == 0) ? "Empty" : "Full"));
  otbMsgDevMacro(<< " * Output projection: " << m_OutputProjectionRef);
  otbMsgDevMacro(<< " * Output Origin: " << m_OutputOrigin);
  otbMsgDevMacro(<< " * Output Spacing: " << m_OutputSpacing);

  //Make sure that the state is clean:
  m_InputTransform = nullptr;
  m_OutputTransform = nullptr;

  bool inputTransformIsSensor = false;
  bool inputTransformIsMap = false;
  bool outputTransformIsSensor = false;
  bool outputTransformIsMap = false;

  //*****************************
  //Set the input transformation
  //*****************************

    // First, try to make a geo transform
  if (!m_InputProjectionRef.empty()) //map projection
    {
    typedef otb::GenericMapProjection<TransformDirection::INVERSE, ScalarType, InputSpaceDimension, InputSpaceDimension>
        InverseMapProjectionType;
    typename InverseMapProjectionType::Pointer mapTransform = InverseMapProjectionType::New();

    mapTransform->SetWkt(m_InputProjectionRef);
    if (mapTransform->IsProjectionDefined())
      {
      m_InputTransform = mapTransform.GetPointer();
      inputTransformIsMap = true;
      otbMsgDevMacro(<< "Input projection set to map transform: " << m_InputTransform);
      }
    }

  // If not, try to make a sensor model
  if ((m_InputTransform.IsNull()) && (m_InputKeywordList.GetSize() > 0))
    {
    typedef otb::ForwardSensorModel<double, InputSpaceDimension, InputSpaceDimension> ForwardSensorModelType;
    typename ForwardSensorModelType::Pointer sensorModel = ForwardSensorModelType::New();

    sensorModel->SetImageGeometry(m_InputKeywordList);

    if (sensorModel->IsValidSensorModel())
      {
      m_InputTransform = sensorModel.GetPointer();
      inputTransformIsSensor = true;
      otbMsgDevMacro(<< "Input projection set to sensor model.");
      }
    }

  if (m_InputTransform.IsNull()) //default if we didn't manage to instantiate it before
    {
    m_InputTransform = itk::IdentityTransform<double, NInputDimensions>::New();
    }

  //*****************************
  //Set the output transformation
  //*****************************
  if (!m_OutputProjectionRef.empty()) //map projection
    {
    typedef otb::GenericMapProjection<TransformDirection::FORWARD, ScalarType, InputSpaceDimension,
    OutputSpaceDimension> ForwardMapProjectionType;
    typename ForwardMapProjectionType::Pointer mapTransform = ForwardMapProjectionType::New();
    mapTransform->SetWkt(m_OutputProjectionRef);
    if (mapTransform->IsProjectionDefined())
      {
      m_OutputTransform = mapTransform.GetPointer();
      outputTransformIsMap = true;
      otbMsgDevMacro(<< "Output projection set to map transform: " << m_OutputTransform);
      }
    }

  // If not, try to make a sensor model
  if ((m_OutputTransform.IsNull()) && (m_OutputKeywordList.GetSize() > 0))
    {
    typedef otb::InverseSensorModel<double, InputSpaceDimension, OutputSpaceDimension> InverseSensorModelType;
    typename InverseSensorModelType::Pointer sensorModel = InverseSensorModelType::New();

    sensorModel->SetImageGeometry(m_OutputKeywordList);

    if (sensorModel->IsValidSensorModel())
      {
      m_OutputTransform = sensorModel.GetPointer();
      outputTransformIsSensor = true;
      otbMsgDevMacro(<< "Output projection set to sensor model");
      }
    }

  if (m_OutputTransform.IsNull()) //default if we didn't manage to instantiate it before
    {
    m_OutputTransform = itk::IdentityTransform<double, NOutputDimensions>::New();
    otbMsgDevMacro(<< "Output projection set to identity");
    }

  m_Transform->SetFirstTransform(m_InputTransform);
  m_Transform->SetSecondTransform(m_OutputTransform);
  m_TransformUpToDate = true;

  //The accuracy information is a simplistic model for now and should be refined
  if ((inputTransformIsSensor || outputTransformIsSensor))
    {
    //Sensor model
    m_TransformAccuracy = Projection::ESTIMATE;
    }
  else if (!outputTransformIsSensor && !outputTransformIsMap)
    {
    //The original image was in lon/lat and we did not change anything
    m_TransformAccuracy = Projection::PRECISE;
    }
  else if (!inputTransformIsSensor && !outputTransformIsSensor && !inputTransformIsMap && !outputTransformIsMap)
    {
    //no transform
    m_TransformAccuracy = Projection::UNKNOWN;
    }
  else
    {
    m_TransformAccuracy = Projection::PRECISE;
    }

}

template<class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions>
typename GenericRSTransform<TScalarType, NInputDimensions, NOutputDimensions>::OutputPointType
GenericRSTransform<TScalarType, NInputDimensions, NOutputDimensions>
::TransformPoint(const InputPointType& point) const
{
  InputPointType inputPoint = point;

  // Apply input origin/spacing
  inputPoint[0] = inputPoint[0] * m_InputSpacing[0] + m_InputOrigin[0];
  inputPoint[1] = inputPoint[1] * m_InputSpacing[1] + m_InputOrigin[1];

  // Transform point
  OutputPointType outputPoint;
  outputPoint = this->GetTransform()->TransformPoint(inputPoint);

  // Apply output origin/spacing
  outputPoint[0] = (outputPoint[0] - m_OutputOrigin[0]) / m_OutputSpacing[0];
  outputPoint[1] = (outputPoint[1] - m_OutputOrigin[1]) / m_OutputSpacing[1];

//  otbMsgDevMacro("GenericRSTransform: " << point << " -> " << outputPoint);

  return outputPoint;
}

template<class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions>
bool
GenericRSTransform<TScalarType, NInputDimensions, NOutputDimensions>
::GetInverse(Self * inverseTransform) const
{
  // Test the inverseTransform pointer
  if (inverseTransform == nullptr)
    {
    return false;
    }

  // Swich projection refs
  inverseTransform->SetInputProjectionRef(m_OutputProjectionRef);
  inverseTransform->SetOutputProjectionRef(m_InputProjectionRef);

  // Switch keywordlists
  inverseTransform->SetInputKeywordList(m_OutputKeywordList);
  inverseTransform->SetOutputKeywordList(m_InputKeywordList);

  // Switch dictionnaries
  inverseTransform->SetInputDictionary(m_OutputDictionary);
  inverseTransform->SetOutputDictionary(m_InputDictionary);

  // Switch spacings
  inverseTransform->SetInputSpacing(m_OutputSpacing);
  inverseTransform->SetOutputSpacing(m_InputSpacing);

  // Switch origins
  inverseTransform->SetInputOrigin(m_OutputOrigin);
  inverseTransform->SetOutputOrigin(m_InputOrigin);

  // Instantiate transform
  inverseTransform->InstantiateTransform();

  return true;
}

template<class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions>
typename GenericRSTransform<TScalarType, NInputDimensions, NOutputDimensions>
::InverseTransformBasePointer
GenericRSTransform<TScalarType, NInputDimensions, NOutputDimensions>
::GetInverseTransform() const
{
  Self * inverseTransform = Self::New();

  bool success = this->GetInverse(inverseTransform);

  if (!success)
    {
    itkExceptionMacro(<< "Failed to create inverse transform");
    }

  return inverseTransform;
}

template<class TScalarType, unsigned int NInputDimensions, unsigned int NOutputDimensions>
void
GenericRSTransform<TScalarType, NInputDimensions, NOutputDimensions>
::PrintSelf(std::ostream& os, itk::Indent indent) const
{
  Superclass::PrintSelf(os, indent);
  os << indent << "Up to date: " << m_TransformUpToDate << std::endl;
  if (m_TransformUpToDate)
    {
    os << indent << "Input transform: "<< std::endl;
    m_InputTransform->Print(os, indent.GetNextIndent());
    os << indent << "Output transform: " << std::endl;
    m_OutputTransform->Print(os, indent.GetNextIndent());
    }
  else
    {
    os << indent << "Input transform: NULL" << std::endl;
    os << indent << "Output transform: NULL" << std::endl;
    }
  os << indent << "Accuracy: "
      << (m_TransformAccuracy == Projection::PRECISE ?
                "PRECISE" : (m_TransformAccuracy == Projection::ESTIMATE ?
                                  "ESTIMATE" : "UNKNOWN")) << std::endl;
}

} // namespace otb

#endif
<|endoftext|>


<commit_before>/*************************************************************************
 *
 *  OpenOffice.org - a multi-platform office productivity suite
 *
 *  $RCSfile: PageMasterPropHdl.hxx,v $
 *
 *  $Revision: 1.7 $
 *
 *  last change: $Author: hr $ $Date: 2006-06-19 18:26:59 $
 *
 *  The Contents of this file are made available subject to
 *  the terms of GNU Lesser General Public License Version 2.1.
 *
 *
 *    GNU Lesser General Public License Version 2.1
 *    =============================================
 *    Copyright 2005 by Sun Microsystems, Inc.
 *    901 San Antonio Road, Palo Alto, CA 94303, USA
 *
 *    This library is free software; you can redistribute it and/or
 *    modify it under the terms of the GNU Lesser General Public
 *    License version 2.1, as published by the Free Software Foundation.
 *
 *    This library is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *    Lesser General Public License for more details.
 *
 *    You should have received a copy of the GNU Lesser General Public
 *    License along with this library; if not, write to the Free Software
 *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 *    MA  02111-1307  USA
 *
 ************************************************************************/

#ifndef _XMLOFF_PAGEMASTERPROPHDL_HXX_
#define _XMLOFF_PAGEMASTERPROPHDL_HXX_

#ifndef _XMLOFF_PROPERTYHANDLERBASE_HXX
#include "xmlprhdl.hxx"
#endif

#ifndef _RTL_USTRING_
#include <rtl/ustring.hxx>
#endif

#ifndef _XMLOFF_XMLTOKEN_HXX
#include "xmltoken.hxx"
#endif

//______________________________________________________________________________
// property handler for style:page-usage (style::PageStyleLayout)

class XMLPMPropHdl_PageStyleLayout : public XMLPropertyHandler
{
public:
    virtual                 ~XMLPMPropHdl_PageStyleLayout();
    virtual sal_Bool        equals(
                                const ::com::sun::star::uno::Any& rAny1,
                                const ::com::sun::star::uno::Any& rAny2
                                ) const;
    virtual sal_Bool        importXML(
                                const ::rtl::OUString& rStrImpValue,
                                ::com::sun::star::uno::Any& rValue,
                                const SvXMLUnitConverter& rUnitConverter
                                ) const;
    virtual sal_Bool        exportXML(
                                ::rtl::OUString& rStrExpValue,
                                const ::com::sun::star::uno::Any& rValue,
                                const SvXMLUnitConverter& rUnitConverter
                                ) const;
};

//______________________________________________________________________________
// property handler for style:num-format (style::NumberingType)

class XMLPMPropHdl_NumFormat : public XMLPropertyHandler
{
public:
    virtual                 ~XMLPMPropHdl_NumFormat();
    virtual sal_Bool        importXML(
                                const ::rtl::OUString& rStrImpValue,
                                ::com::sun::star::uno::Any& rValue,
                                const SvXMLUnitConverter& rUnitConverter
                                ) const;
    virtual sal_Bool        exportXML(
                                ::rtl::OUString& rStrExpValue,
                                const ::com::sun::star::uno::Any& rValue,
                                const SvXMLUnitConverter& rUnitConverter
                                ) const;
};

//______________________________________________________________________________
// property handler for style:num-letter-sync (style::NumberingType)

class XMLPMPropHdl_NumLetterSync : public XMLPropertyHandler
{
public:
    virtual                 ~XMLPMPropHdl_NumLetterSync();
    virtual sal_Bool        importXML(
                                const ::rtl::OUString& rStrImpValue,
                                ::com::sun::star::uno::Any& rValue,
                                const SvXMLUnitConverter& rUnitConverter
                                ) const;
    virtual sal_Bool        exportXML(
                                ::rtl::OUString& rStrExpValue,
                                const ::com::sun::star::uno::Any& rValue,
                                const SvXMLUnitConverter& rUnitConverter
                                ) const;
};

//______________________________________________________________________________
// property handler for style:paper-tray-number

class XMLPMPropHdl_PaperTrayNumber : public XMLPropertyHandler
{
public:
    virtual                 ~XMLPMPropHdl_PaperTrayNumber();
    virtual sal_Bool        importXML(
                                const ::rtl::OUString& rStrImpValue,
                                ::com::sun::star::uno::Any& rValue,
                                const SvXMLUnitConverter& rUnitConverter
                                ) const;
    virtual sal_Bool        exportXML(
                                ::rtl::OUString& rStrExpValue,
                                const ::com::sun::star::uno::Any& rValue,
                                const SvXMLUnitConverter& rUnitConverter
                                ) const;
};

//______________________________________________________________________________
// property handler for style:print

class XMLPMPropHdl_Print : public XMLPropertyHandler
{
protected:
    ::rtl::OUString         sAttrValue;

public:
                            XMLPMPropHdl_Print( enum ::xmloff::token::XMLTokenEnum eValue );
    virtual                 ~XMLPMPropHdl_Print();

    virtual sal_Bool        importXML(
                                const ::rtl::OUString& rStrImpValue,
                                ::com::sun::star::uno::Any& rValue,
                                const SvXMLUnitConverter& rUnitConverter
                                ) const;
    virtual sal_Bool        exportXML(
                                ::rtl::OUString& rStrExpValue,
                                const ::com::sun::star::uno::Any& rValue,
                                const SvXMLUnitConverter& rUnitConverter
                                ) const;
};

//______________________________________________________________________________
// property handler for style:table-centering

class XMLPMPropHdl_CenterHorizontal : public XMLPropertyHandler
{
public:
    virtual                 ~XMLPMPropHdl_CenterHorizontal();
    virtual sal_Bool        importXML(
                                const ::rtl::OUString& rStrImpValue,
                                ::com::sun::star::uno::Any& rValue,
                                const SvXMLUnitConverter& rUnitConverter
                                ) const;
    virtual sal_Bool        exportXML(
                                ::rtl::OUString& rStrExpValue,
                                const ::com::sun::star::uno::Any& rValue,
                                const SvXMLUnitConverter& rUnitConverter
                                ) const;
};

class XMLPMPropHdl_CenterVertical : public XMLPropertyHandler
{
public:
    virtual                 ~XMLPMPropHdl_CenterVertical();
    virtual sal_Bool        importXML(
                                const ::rtl::OUString& rStrImpValue,
                                ::com::sun::star::uno::Any& rValue,
                                const SvXMLUnitConverter& rUnitConverter
                                ) const;
    virtual sal_Bool        exportXML(
                                ::rtl::OUString& rStrExpValue,
                                const ::com::sun::star::uno::Any& rValue,
                                const SvXMLUnitConverter& rUnitConverter
                                ) const;
};

#endif

<commit_msg>INTEGRATION: CWS sb59 (1.7.24); FILE MERGED 2006/08/09 12:53:54 sb 1.7.24.1: #i67487# Made code warning-free (wntmsci10).<commit_after>/*************************************************************************
 *
 *  OpenOffice.org - a multi-platform office productivity suite
 *
 *  $RCSfile: PageMasterPropHdl.hxx,v $
 *
 *  $Revision: 1.8 $
 *
 *  last change: $Author: obo $ $Date: 2006-10-12 14:46:02 $
 *
 *  The Contents of this file are made available subject to
 *  the terms of GNU Lesser General Public License Version 2.1.
 *
 *
 *    GNU Lesser General Public License Version 2.1
 *    =============================================
 *    Copyright 2005 by Sun Microsystems, Inc.
 *    901 San Antonio Road, Palo Alto, CA 94303, USA
 *
 *    This library is free software; you can redistribute it and/or
 *    modify it under the terms of the GNU Lesser General Public
 *    License version 2.1, as published by the Free Software Foundation.
 *
 *    This library is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *    Lesser General Public License for more details.
 *
 *    You should have received a copy of the GNU Lesser General Public
 *    License along with this library; if not, write to the Free Software
 *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 *    MA  02111-1307  USA
 *
 ************************************************************************/

#ifndef _XMLOFF_PAGEMASTERPROPHDL_HXX_
#define _XMLOFF_PAGEMASTERPROPHDL_HXX_

#ifndef _XMLOFF_PROPERTYHANDLERBASE_HXX
#include "xmlprhdl.hxx"
#endif

#ifndef _RTL_USTRING_
#include <rtl/ustring.hxx>
#endif

#ifndef _XMLOFF_XMLTOKEN_HXX
#include "xmltoken.hxx"
#endif

//______________________________________________________________________________
// property handler for style:page-usage (style::PageStyleLayout)

class XMLPMPropHdl_PageStyleLayout : public XMLPropertyHandler
{
public:
    virtual                 ~XMLPMPropHdl_PageStyleLayout();
    virtual bool            equals(
                                const ::com::sun::star::uno::Any& rAny1,
                                const ::com::sun::star::uno::Any& rAny2
                                ) const;
    virtual sal_Bool        importXML(
                                const ::rtl::OUString& rStrImpValue,
                                ::com::sun::star::uno::Any& rValue,
                                const SvXMLUnitConverter& rUnitConverter
                                ) const;
    virtual sal_Bool        exportXML(
                                ::rtl::OUString& rStrExpValue,
                                const ::com::sun::star::uno::Any& rValue,
                                const SvXMLUnitConverter& rUnitConverter
                                ) const;
};

//______________________________________________________________________________
// property handler for style:num-format (style::NumberingType)

class XMLPMPropHdl_NumFormat : public XMLPropertyHandler
{
public:
    virtual                 ~XMLPMPropHdl_NumFormat();
    virtual sal_Bool        importXML(
                                const ::rtl::OUString& rStrImpValue,
                                ::com::sun::star::uno::Any& rValue,
                                const SvXMLUnitConverter& rUnitConverter
                                ) const;
    virtual sal_Bool        exportXML(
                                ::rtl::OUString& rStrExpValue,
                                const ::com::sun::star::uno::Any& rValue,
                                const SvXMLUnitConverter& rUnitConverter
                                ) const;
};

//______________________________________________________________________________
// property handler for style:num-letter-sync (style::NumberingType)

class XMLPMPropHdl_NumLetterSync : public XMLPropertyHandler
{
public:
    virtual                 ~XMLPMPropHdl_NumLetterSync();
    virtual sal_Bool        importXML(
                                const ::rtl::OUString& rStrImpValue,
                                ::com::sun::star::uno::Any& rValue,
                                const SvXMLUnitConverter& rUnitConverter
                                ) const;
    virtual sal_Bool        exportXML(
                                ::rtl::OUString& rStrExpValue,
                                const ::com::sun::star::uno::Any& rValue,
                                const SvXMLUnitConverter& rUnitConverter
                                ) const;
};

//______________________________________________________________________________
// property handler for style:paper-tray-number

class XMLPMPropHdl_PaperTrayNumber : public XMLPropertyHandler
{
public:
    virtual                 ~XMLPMPropHdl_PaperTrayNumber();
    virtual sal_Bool        importXML(
                                const ::rtl::OUString& rStrImpValue,
                                ::com::sun::star::uno::Any& rValue,
                                const SvXMLUnitConverter& rUnitConverter
                                ) const;
    virtual sal_Bool        exportXML(
                                ::rtl::OUString& rStrExpValue,
                                const ::com::sun::star::uno::Any& rValue,
                                const SvXMLUnitConverter& rUnitConverter
                                ) const;
};

//______________________________________________________________________________
// property handler for style:print

class XMLPMPropHdl_Print : public XMLPropertyHandler
{
protected:
    ::rtl::OUString         sAttrValue;

public:
                            XMLPMPropHdl_Print( enum ::xmloff::token::XMLTokenEnum eValue );
    virtual                 ~XMLPMPropHdl_Print();

    virtual sal_Bool        importXML(
                                const ::rtl::OUString& rStrImpValue,
                                ::com::sun::star::uno::Any& rValue,
                                const SvXMLUnitConverter& rUnitConverter
                                ) const;
    virtual sal_Bool        exportXML(
                                ::rtl::OUString& rStrExpValue,
                                const ::com::sun::star::uno::Any& rValue,
                                const SvXMLUnitConverter& rUnitConverter
                                ) const;
};

//______________________________________________________________________________
// property handler for style:table-centering

class XMLPMPropHdl_CenterHorizontal : public XMLPropertyHandler
{
public:
    virtual                 ~XMLPMPropHdl_CenterHorizontal();
    virtual sal_Bool        importXML(
                                const ::rtl::OUString& rStrImpValue,
                                ::com::sun::star::uno::Any& rValue,
                                const SvXMLUnitConverter& rUnitConverter
                                ) const;
    virtual sal_Bool        exportXML(
                                ::rtl::OUString& rStrExpValue,
                                const ::com::sun::star::uno::Any& rValue,
                                const SvXMLUnitConverter& rUnitConverter
                                ) const;
};

class XMLPMPropHdl_CenterVertical : public XMLPropertyHandler
{
public:
    virtual                 ~XMLPMPropHdl_CenterVertical();
    virtual sal_Bool        importXML(
                                const ::rtl::OUString& rStrImpValue,
                                ::com::sun::star::uno::Any& rValue,
                                const SvXMLUnitConverter& rUnitConverter
                                ) const;
    virtual sal_Bool        exportXML(
                                ::rtl::OUString& rStrExpValue,
                                const ::com::sun::star::uno::Any& rValue,
                                const SvXMLUnitConverter& rUnitConverter
                                ) const;
};

#endif

<|endoftext|>