Ejemplo n.º 1
0
/// \brief Save the specified coord to the specified Boost Property Tree ptree
///
/// \relates coord
void cath::geom::save_to_ptree(ptree       &arg_ptree, ///< The ptree to which the coord should be saved
                               const coord &arg_coord  ///< The coord to be saved
                               ) {
	arg_ptree.put( "x", arg_coord.get_x() );
	arg_ptree.put( "y", arg_coord.get_y() );
	arg_ptree.put( "z", arg_coord.get_z() );
}
Ejemplo n.º 2
0
void ProjectConfiguration::WritePtree(ptree& pt,
									  const wxString& proj_path)
{
    pt.put("project.title", project_title);
    ptree& subtree = pt.put("project.layers.layer","");
    layer_confs[0]->WritePtree(subtree, proj_path);
}
	void save(ptree & pt)
	{
		LOG(LTRACE) << "CvFindChessboardCornersProps::save()\n";
		pt.put("width", patternSize.width);
		pt.put("height", patternSize.height);
		pt.put("squareSize", squareSize);
		pt.put("findSubpix", findSubpix);
	}
Ejemplo n.º 4
0
void EnvObject::saveHelper( ptree &tree ) {

    tree.put("x", xCoordinate);
    tree.put("y", yCoordinate);
    tree.put("width", width);
    tree.put("height", height);
    tree.put("temp", temp);
    tree.put("source", source);
}
Ejemplo n.º 5
0
void LayerConfiguration::WritePtree(ptree& pt,
									const wxString& proj_path)
{
    ptree& subtree = pt.put("datasource", "");
    datasource->WritePtree(subtree, proj_path);
    pt.put("layername", layer_name);
    pt.put("title", layer_title);
    if (variable_order) variable_order->WritePtree(pt, proj_path);
	if (custom_classifs) custom_classifs->WritePtree(pt, proj_path);
	if (spatial_weights) spatial_weights->WritePtree(pt, proj_path);
	if (default_vars) default_vars->WritePtree(pt, proj_path);
}
	/*!
	 * \copydoc Base::Props::save
	 */
	void save(ptree & pt)
	{
		pt.put("dev.device", device);
		pt.put("dev.input", input);
		pt.put("dev.norm", norm);
		pt.put("dev.format", format);
		pt.put("dev.width", width);
		pt.put("dev.height", height);

		pt.put("image.brightness", brightness);
		pt.put("image.contrast", contrast);
		pt.put("image.saturation", saturation);
		pt.put("image.hue", hue);
	}
void DeviceMatcher::write(const DeviceMatcher &matcher,ptree& writeTo){

    writeTo.put(CLASS_NAME_KEY,matcher.className());

    matcher.writeSelf(writeTo);

}
Ejemplo n.º 8
0
//for yaw and pitch
std::string JsonObj::put(std::string& data, ptree& node){
	node.put("",data);

	//savoir si c'est l'arbre yaw ou pitch
	std::ostringstream buf;
	write_json (buf, node, false);
	std::string json = buf.str();
}
Ejemplo n.º 9
0
Archivo: api.cpp Proyecto: cppan/cppan
ptree api_call(const Remote &r, const String &api, ptree request)
{
    request.put("auth.user", r.user);
    request.put("auth.token", r.token);

    HttpRequest req = httpSettings;
    req.type = HttpRequest::POST;
    req.url = r.url + "/api/" + api;
    req.data = ptree2string(request);
    auto resp = url_request(req);
    auto ret = string2ptree(resp.response);
    if (resp.http_code != 200)
    {
        auto e = ret.get<String>("error", "");
        throw std::runtime_error(e);
    }

    return string2ptree(resp.response);
}
Ejemplo n.º 10
0
    bool ConfigTree::ptreeFromParam(ConfigParameter fromParam, ptree &toPtree)
    {
        CONFIGSYS_DEBUG_CALLS;

        toPtree = ptree();

        toPtree.put("desc", fromParam.getDescription());
        
        std::string modStr = (fromParam.isModified())? "true" : "false";
        toPtree.put("modified", modStr);

        std::string lockStr = (fromParam.isLocked())? "true" : "false";
        toPtree.put("locked", lockStr);


        value_type vt = fromParam.getType();
        std::string typStr = makeValueTypeString(vt);
        toPtree.put("type", typStr);
        
        return addParamValueandRangeToPtree(fromParam, toPtree);
    }
Ejemplo n.º 11
0
  void process_pde_element(PdeElementP element, ptree& node) {
    if (!element) return;
    node.put("id", element->GetId());

    PdfRect bbox;
    element->GetBBox(&bbox);
    node.put("left", bbox.left);
    node.put("bottom", bbox.bottom);
    node.put("right", bbox.right);
    node.put("top", bbox.top);

    switch (element->GetType())
    {
    case kPdeText:
    case kPdeTextLine:
    case kPdeWord:
      process_pde_text((PdeText*)element, node);
      break;
    case kPdeImage:
      process_pde_image((PdeImage*)element, node);
      break;
    case kPdePath:
    case kPdeLine:
    case kPdeRect:
      process_pde_path((PdePath*)element, node);
      break;
    case kPdeTable:
      process_pde_table((PdeTable*)element, node);
      break;
    default:
      break;
    }
    auto num_childs = element->GetNumChildren();
    for (auto i = 0; i < num_childs; i++) {
      ptree elem_node;
      PdeElementP child = element->GetChild(i);
      process_pde_element(child, elem_node);
      node.add_child("element", elem_node);
    }
  }
Ejemplo n.º 12
0
void CameraProps::save(ptree & pt) {
	pt.put("device.device", device);
	pt.put("device.io", convIOMethod(io));
	pt.put("device.video_standard", convStandard(standard));
	pt.put("device.width", width);
	pt.put("device.height", height);
	pt.put("device.channel", channel);
}
Ejemplo n.º 13
0
	void save(ptree & pt) {
		pt.put("directory", directory);
		pt.put("pattern", pattern);
		pt.put("sort", sort);
		pt.put("prefetch", prefetch);
		pt.put("triggered", triggered);
		pt.put("loop", loop);
	}
Ejemplo n.º 14
0
  void process_pde_text(PdeTextP text, ptree& node) {
    PdfTextState ts;

    switch (text->GetType())
    {
    case kPdeText:
    {
      node.put("type", "text_paragraph");
      std::wstring s;
      s.resize(text->GetText(nullptr, 0));
      text->GetText((wchar_t*)s.c_str(), s.size());
      node.put("text", w2utf8(s.c_str()));
      text->GetTextState(&ts);
      auto num_lines = text->GetNumTextLines();
      for (auto i = 0; i < num_lines; i++) {
        ptree line_node;
        PdeTextLineP text_line = text->GetTextLine(i);
        process_pde_element((PdeElementP)text_line, line_node);
        node.add_child("element", line_node);
      }
    }
    break;
    case kPdeTextLine:
    {
      PdeTextLineP text_line = (PdeTextLine*)text;
      node.put("type", "text_line");
      std::wstring s;
      s.resize(text_line->GetText(nullptr, 0));
      text_line->GetText((wchar_t*)s.c_str(), s.size());
      node.put("text", w2utf8(s.c_str()));
      text_line->GetTextState(&ts);
      auto num_word = text_line->GetNumWords();
      for (auto i = 0; i < num_word; i++) {
        ptree word_node;
        PdeWordP text_word = text_line->GetWord(i);
        process_pde_element((PdeElementP)text_word, word_node);
        node.add_child("element", word_node);
      }
    }
    break;
    case kPdeWord:
    {
      PdeWordP word = (PdeWord*)text;
      node.put("type", "text_word");
      std::wstring s;
      s.resize(word->GetText(nullptr, 0));
      word->GetText((wchar_t*)s.c_str(), s.size());
      node.put("text", w2utf8(s.c_str()));
      word->GetTextState(&ts);
    }
    break;
    }
    process_pdf_text_state(ts, node);
  }
Ejemplo n.º 15
0
 void process_page(PdfPageP page, ptree& node) {
   if (!page) return;
   node.put("number", page->GetNumber());
   node.put("rotate", page->GetRotate());
   PdfPageMapParams params;
   PdePageMapP page_map = page->AcquirePageMap(&params, nullptr, nullptr);
   if (page_map == nullptr)
     return;
   int num_elements = page_map->GetNumElements();
   for (auto i = 0; i < num_elements; i++) {
     ptree elem_tree;
     PdeElementP element = page_map->GetElement(i);
     process_pde_element(element, elem_tree);
     node.add_child("element", elem_tree);
   }
   page->ReleasePageMap();
 }
Ejemplo n.º 16
0
 void process_pdf_text_state(PdfTextState& ts, ptree& node) {
   node.put("char_spacing", ts.char_spacing);
   node.put("flags", ts.flags);
   process_pdf_font(ts.font, node);
   node.put("font_size", ts.font_size);
   
   node.put("fill_alpha", ts.color_state.fill_opacity);
   process_pdf_rgb(ts.color_state.fill_color, node);
   node.put("stroke_alpha", ts.color_state.stroke_opacity);
   process_pdf_rgb(ts.color_state.stroke_color, node);
   
   node.put("word_spacing", ts.word_spacing);
 }
Ejemplo n.º 17
0
void MultiMatcher::writeSelf(ptree& writeTo) const {

    writeTo.put(OPERATE_MODE_KEY,OPERATE_MODE_MAP_NAME[m_operateMode]);

    int index=0;

    ptree values;

    for(auto &child : m_values){
        ptree childTree;

        write(child,childTree);

        values.add_child(MATCHER_KEY,childTree);
    }

    writeTo.put_child(VALUES_KEY,values);

}
Ejemplo n.º 18
0
 void process_pdf_font(PdfFontP font, ptree& node) {
   std::wstring s1, s2, s3;
   s1.resize(font->GetFaceName(nullptr, 0));
   font->GetFaceName((wchar_t*)s1.c_str(), s1.size());
   node.put("face_name", w2utf8(s1.c_str()));
   s2.resize(font->GetFontName(nullptr, 0));
   font->GetFontName((wchar_t*)s2.c_str(), s2.size());
   node.put("font_name", w2utf8(s2.c_str()));
   s3.resize(font->GetSystemFontName(nullptr, 0));
   font->GetSystemFontName((wchar_t*)s3.c_str(), s3.size());
   node.put("system_font_name", w2utf8(s3.c_str()));
   node.put("system_font_bold", font->GetSystemFontBold());
   node.put("system_font_italic", font->GetSystemFontItalic());
   node.put("system_font_charset", font->GetSystemFontCharset());
 }
Ejemplo n.º 19
0
 void process_pde_path(PdePathP path, ptree& node) {
   node.put("type", "path");
   switch (path->GetType())
   {
   case kPdePath:
     node.put("type", "path");
     break;
   case kPdeRect:
     node.put("type", "rect");
     break;
   case kPdeLine:
     node.put("type", "line");
     break;
   }
   PdfGraphicState gs;
   path->GetGraphicState(&gs);
   node.put("fill_alpha", gs.color_state.fill_opacity);
   process_pdf_rgb(gs.color_state.fill_color, node);
   node.put("stroke_alpha", gs.color_state.stroke_opacity);
   process_pdf_rgb(gs.color_state.stroke_color, node);
 }
Ejemplo n.º 20
0
		/*!
		 * \copydoc Base::Props::save
		 */
		void save(ptree & pt) {
			pt.put("triggered", triggered);
		}
Ejemplo n.º 21
0
	/*!
	 * \copydoc Base::Props::save
	 */
	void save(ptree & pt)
	{
		pt.put("sample_time", sample_time);
		pt.put("sample_delay", sample_delay);
		pt.put("window_type", window_type);
	}
Ejemplo n.º 22
0
bool Config::save(const std::string &filename)
{
    // Save stuff
    pt_config.put("video.mode",               video.mode);
    pt_config.put("video.window.scale",       video.scale);
    pt_config.put("video.scanlines",          video.scanlines);
    pt_config.put("video.fps",                video.fps);
    pt_config.put("video.widescreen",         video.widescreen);
    pt_config.put("video.hires",              video.hires);

    pt_config.put("sound.enable",             sound.enabled);
    pt_config.put("sound.advertise",          sound.advertise);
    pt_config.put("sound.preview",            sound.preview);
    pt_config.put("sound.fix_samples",        sound.fix_samples);

    pt_config.put("controls.gear",            controls.gear);
    pt_config.put("controls.steerspeed",      controls.steer_speed);
    pt_config.put("controls.pedalspeed",      controls.pedal_speed);
    pt_config.put("controls.keyconfig.up",    controls.keyconfig[0]);
    pt_config.put("controls.keyconfig.down",  controls.keyconfig[1]);
    pt_config.put("controls.keyconfig.left",  controls.keyconfig[2]);
    pt_config.put("controls.keyconfig.right", controls.keyconfig[3]);
    pt_config.put("controls.keyconfig.acc",   controls.keyconfig[4]);
    pt_config.put("controls.keyconfig.brake", controls.keyconfig[5]);
    pt_config.put("controls.keyconfig.gear1", controls.keyconfig[6]);
    pt_config.put("controls.keyconfig.gear2", controls.keyconfig[7]);
    pt_config.put("controls.keyconfig.start", controls.keyconfig[8]);
    pt_config.put("controls.keyconfig.coin",  controls.keyconfig[9]);
    pt_config.put("controls.keyconfig.menu",  controls.keyconfig[10]);
    pt_config.put("controls.keyconfig.view",  controls.keyconfig[11]);
    pt_config.put("controls.padconfig.acc",   controls.padconfig[0]);
    pt_config.put("controls.padconfig.brake", controls.padconfig[1]);
    pt_config.put("controls.padconfig.gear1", controls.padconfig[2]);
    pt_config.put("controls.padconfig.gear2", controls.padconfig[3]);
    pt_config.put("controls.padconfig.start", controls.padconfig[4]);
    pt_config.put("controls.padconfig.coin",  controls.padconfig[5]);
    pt_config.put("controls.padconfig.menu",  controls.padconfig[6]);
    pt_config.put("controls.padconfig.view",  controls.padconfig[7]);
    pt_config.put("controls.analog.<xmlattr>.enabled", controls.analog);

    pt_config.put("engine.time", engine.freeze_timer ? 4 : engine.dip_time);
    pt_config.put("engine.traffic", engine.disable_traffic ? 4 : engine.dip_traffic);
    pt_config.put("engine.japanese_tracks", engine.jap);
    pt_config.put("engine.prototype", engine.prototype);
    pt_config.put("engine.levelobjects", engine.level_objects);
    pt_config.put("engine.new_attract", engine.new_attract);

    pt_config.put("time_trial.laps",    ttrial.laps);
    pt_config.put("time_trial.traffic", ttrial.traffic);
    pt_config.put("continuous.traffic", cont_traffic), 

    ttrial.laps    = pt_config.get("time_trial.laps",    5);
    ttrial.traffic = pt_config.get("time_trial.traffic", 3);
    cont_traffic   = pt_config.get("continuous.traffic", 3);

    try
    {
        write_xml(filename, pt_config, std::locale(), xml_writer_settings('\t', 1)); // Tab space 1
    }
    catch (std::exception &e)
    {
        std::cout << "Error saving config: " << e.what() << "\n";
        return false;
    }
    return true;
}
Ejemplo n.º 23
0
//run analysis on src image
void run_analysis(Mat &src, Mat &dst, analysis_type type, vector<double> params) {
	string output_filepath = output_stem + "_" + analysis_abbr[type]; //file name
	string title = analysis_name[type]; //display window title
	string ptree_element = analysis_abbr[type]; //json tree title

	bool apply_autolevels = autolevels && (type == A_ELA || type == A_LG || type == A_AVGDIST);
	if(apply_autolevels) {
		output_filepath += "_autolevels.png";
		ptree_element += "_autolevels";
	} else {
		output_filepath += ".png";
	}

	switch(type) {
		case A_ELA:
			error_level_analysis(src, dst, params[0]);
			root.put(ptree_element + ".quality", params[0]);
			break;
		case A_LG:
			luminance_gradient(src, dst);
			break;
		case A_AVGDIST:
			average_distance(src, dst);
			break;
		case A_HSV:
			hsv_histogram(src, dst, params[0]);
			root.put(ptree_element + ".whitebg", (bool)params[0]);
			break;
		case A_LAB:
			lab_histogram(src, dst, params[0]);
			root.put(ptree_element + ".whitebg", (bool)params[0]);
			break;
		case A_LAB_FAST:
			lab_histogram_fast(src, dst, params[0]);
			root.put(ptree_element + ".whitebg", (bool)params[0]);
			break;
		case A_COPY_MOVE_DCT:
			copy_move_dct(src, dst, params[0], params[1]);
			root.put(ptree_element + ".retain", params[0]);
			root.put(ptree_element + ".qcoeff", params[1]);
			break;
	}

	if(apply_autolevels) {
		hsv_histogram_stretch(dst, dst);
	}

	if(output) { //output image & add to ptree
		bool write_success = imwrite(output_filepath, dst);
		if(!write_success) {
			root.put(ptree_element + ".filename", "Error! Do you have write permission?");
		} else {
			string filepath = canonical(output_filepath).make_preferred().string();
			root.put(ptree_element + ".filename", filepath);
		}
	}
	
	if(display) { //display right away, waitKey(0) at the end of program
		namedWindow(title);
		imshow(title, dst);
	} else { //release memory
		dst.release();
	}
}
Ejemplo n.º 24
0
int main(int argc, char *argv[]) {
	//declare program options
	options_description desc("USAGE: phoenix -f <path_to_file> [options]\nAllowed options");
	desc.add_options()
		("help,h", "List all arguments - produce help message")
		("file,f", value<string>()->required(), "Source image file")

		("ela", value<int>()->implicit_value(70), "Error Level Analysis [quality]")
		("hsv", value<int>()->implicit_value(0), "HSV Colorspace Histogram [whitebg]")
		("lab", value<int>()->implicit_value(0), "Lab Colorspace Histogram [whitebg]")
		("labfast", value<int>()->implicit_value(0), "Lab Colorspace Histogram (Fast Version) [whitebg]")
		("lg", bool_switch()->default_value(false), "Luminance Gradient")
		("avgdist", bool_switch()->default_value(false), "Average Distance")
		("copymove", value<vector<double>>()->multitoken()->implicit_value(vector<double>{4, 1.0}), "Copy-Move Detection (DCT) [retain] [qcoeff]")

		("autolevels,a", bool_switch()->default_value(false), "Apply histogram stretch to outputs")
		("quality,q", bool_switch()->default_value(true), "Estimate JPEG Quality")

		("output,o", value<string>()->implicit_value("./"), "Output folder path")
		("display,d", bool_switch()->default_value(false), "Display outputs")
		("verbose,v", bool_switch()->default_value(false), "Verbose (debug) mode")
		("json,j", bool_switch()->default_value(false), "Output JSON")
	;

	variables_map vm;

	try { //try to parse command options
		store(
			command_line_parser(argc, argv).options(desc)
			.style(
				command_line_style::allow_short
				| command_line_style::short_allow_next
				| command_line_style::short_allow_adjacent
				| command_line_style::allow_dash_for_short
				| command_line_style::allow_long
				| command_line_style::long_allow_next
				| command_line_style::long_allow_adjacent
				| command_line_style::allow_long_disguise
				).run()
			, vm);

		if (vm.count("help")) { //print help text before notify()
			cout << desc << endl;
			return 0;
		}
		notify(vm); //send commands to variables_map
	} catch (const exception &e) { //error with command options
		cout << "Error: Cannot parse program commands!" << endl;
		cout << e.what() << endl;
		cout << "Use -h or -help flag to see available commands." << endl;
		return 1;
	} catch(...) {
		cout << "Error: Fatal error while parsing options." << endl;
		return 1;
	}

	//some path info
	path source_path;
	path output_path;
	Mat source_image;

	try { //check and try to open source image file (-f)
		source_path = vm["file"].as<string>();
		if(!exists(source_path)) {
			cout << "Error: File not found!" << endl;
			cout << "File path input: " << source_path << endl;
			return 1;
		}

		//load image to memory
		source_image = imread(source_path.string(), CV_LOAD_IMAGE_COLOR);
		if(source_image.data == NULL) {
			cout << "Error: Cannot read image!" << endl;
			cout << "File path input: " << source_path << endl;
			return 1;
		}

		//validate output path
		if(vm.count("output")) {
			output_path = vm["output"].as<string>();
			if(!is_directory(output_path)) {
				cout << "Error: Output directory does not exist!" << endl;
				cout << "Output directory input: " << output_path << endl;
				return 1;
			}
			output_path = canonical(output_path.make_preferred());
		}
	} catch(const exception &e) { //cannot load the image for some reason
		cout << "Error: Problem while opening the file!" << endl;
		cout << e.what() << endl;
		return 1;
	}

	//assign globals
	display = vm["display"].as<bool>();
	output = vm.count("output");
	autolevels = vm["autolevels"].as<bool>();
	output_stem = output_path.string() + "/" + source_path.stem().string();
	
	bool verbose = vm["verbose"].as<bool>();

	if(vm.count("ela")) {
		Mat ela;
		vector<double> params {(double) vm["ela"].as<int>()};

		run_analysis(source_image, ela, A_ELA, params);
	}

	if(vm["lg"].as<bool>()) {
		Mat lg;
		vector<double> params;

		run_analysis(source_image, lg, A_LG, params);
	}

	if(vm["avgdist"].as<bool>()) {
		Mat avgdist;
		vector<double> params;

		run_analysis(source_image, avgdist, A_AVGDIST, params);
	}

	if(vm.count("hsv")) {
		Mat hsv;
		vector<double> params {(double) vm["hsv"].as<int>()};

		run_analysis(source_image, hsv, A_HSV, params);
	}

	if(vm.count("lab")) {
		Mat lab;
		vector<double> params {(double) vm["lab"].as<int>()};

		run_analysis(source_image, lab, A_LAB, params);
	}

	if(vm.count("labfast")) {
		Mat lab;
		vector<double> params {(double) vm["labfast"].as<int>()};

		run_analysis(source_image, lab, A_LAB_FAST, params);
	}

	if(vm.count("copymove")) {
		Mat copymove;
		vector<double> input = vm["copymove"].as<vector<double>>();
		vector<double> params;
		if(input.size() == 1) {
			if(input[0] > 16) input[0] = 16;
			params = {input[0], 1.0};
		} else {
			params = input;
		}

		run_analysis(source_image, copymove, A_COPY_MOVE_DCT, params);
	}

	if(vm["quality"].as<bool>()) {
		int num_qtables = 0;
		vector<qtable> qtables;
		vector<double> quality;

		num_qtables = estimate_jpeg_quality(source_path.string().c_str(), qtables, quality);

		if(num_qtables > 0) { //if we have quantization tables, save them to ptree
			root.put("imagick_estimate", quality[0]);
			root.put("hf_estimate", quality[1]);
			for(int i=0; i<num_qtables; i++) { //loop through the table and append as comma separated vals
				stringstream dqt;
				for(int j=0; j<8; j++) {
					for(int k=0; k<8; k++) {
						dqt << qtables[i].table.at<float>(j, k);
						if(j*k < 48) {
							dqt << ",";
						}
					}
				}
				stringstream tableindex;
				tableindex << "qtables." << i;
				root.put(tableindex.str(), dqt.str());
			}
		}
	}

	if(vm.count("output") == 0 && vm["display"].defaulted()) {
		cout << "Warning: No -output or -display option specified. You might want to use one (or both)." << endl;
	}

	if(vm["json"].as<bool>() || !vm["quality"].defaulted()) {
		write_json(cout, root);
	}

	if(display) {
		waitKey(0);
	}

	return 0;
}
Ejemplo n.º 25
0
 void process_pde_table(PdeTableP table, ptree& node) {
   node.put("type", "table");
   //todo rows, cells
 }
Ejemplo n.º 26
0
 void process_pde_image(PdeImageP image, ptree& node) {
   node.put("type", "image");
   //todo???
 }
Ejemplo n.º 27
0
	/*!
	 * \copydoc Base::Props::save
	 */
	void save(ptree & pt)
	{
		pt.put("type", type2str(type));
		pt.put("maxval", maxval);
		pt.put("thresh", thresh);
	}
Ejemplo n.º 28
0
  void process_pdf_annot(PdfAnnotP annot, ptree& node) {
    PdfAnnotSubtype subtype = annot->GetSubtype();
    switch (subtype) {
    case kAnnotText:
      node.put("subtype", "Text"); break;
    case kAnnotLink:
      node.put("subtype", "Link"); break;
    case kAnnotFreeText:
      node.put("subtype", "FreeText"); break;
    case kAnnotLine:
      node.put("subtype", "Line"); break;
    case kAnnotSquare:
      node.put("subtype", "Square"); break;
    case kAnnotCircle:
      node.put("subtype", "Circle"); break;
    case kAnnotPolygon:
      node.put("subtype", "Polygon"); break;
    case kAnnotPolyLine:
      node.put("subtype", "Polyline"); break;
    case kAnnotHighlight:
      node.put("subtype", "Highlight"); break;
    case kAnnotUnderline:
      node.put("subtype", "Underline"); break;
    case kAnnotSquiggly:
      node.put("subtype", "Squiggly"); break;
    case kAnnotStrikeOut:
      node.put("subtype", "StrikeOut"); break;
    case kAnnotStamp:
      node.put("subtype", "Stamp"); break;
    case kAnnotCaret:
      node.put("subtype", "Caret"); break;
    case kAnnotInk:
      node.put("subtype", "Ink"); break;
    case kAnnotPopup:
      node.put("subtype", "Popup"); break;
    case kAnnotFileAttachment:
      node.put("subtype", "FileAttachment"); break;
    case kAnnotSound:
      node.put("subtype", "Sound"); break;
    case kAnnotMovie:
      node.put("subtype", "Movie"); break;
    case kAnnotWidget:
      node.put("subtype", "Widget"); break;
    case kAnnotScreen:
      node.put("subtype", "Screen"); break;
    case kAnnotPrinterMark:
      node.put("subtype", "PrinterMark"); break;
    case kAnnotTrapNet:
      node.put("subtype", "TrapNet"); break;
    case kAnnotWatermark:
      node.put("subtype", "WaterMark"); break;
    case kAnnot3D:
      node.put("subtype", "3D"); break;
    case kAnnotRedact:
      node.put("subtype", "Redact"); break;
    case kAnnotUnknown:
    default:
      node.put("subtype", "Unknown"); break;
    }

    PdfAnnotAppearance ap;
    annot->GetAppearance(&ap);
    ptree appearance;
    ptree fill_node;
    switch (ap.fill_type) {
    case kFillTypeNone: fill_node.put("fill_type", "none"); break;
    case kFillTypeSolid: fill_node.put("fill_type", "solid"); break;
    }
    process_pdf_rgb(ap.fill_color, fill_node);
    appearance.add_child("fill", fill_node);

    ptree border_node;
    switch (ap.border) {
    case kBorderSolid: border_node.put("border", "solid"); break;
    case kBorderDashed: border_node.put("border", "dashed"); break;
    case kBorderBeveled: border_node.put("border", "beveled"); break;
    case kBorderUnderline: border_node.put("border", "underline"); break;
    case kBorderInset: border_node.put("border", "inset"); break;
    }
    border_node.put("width", ap.border_width);
    process_pdf_rgb(ap.border_color, border_node);
    appearance.add_child("fill", border_node);
    appearance.put("opacity", ap.opacity);
    appearance.put("font_size", ap.font_size);

    node.add_child("appearance", appearance);
  }
Ejemplo n.º 29
0
	/*!
	 * \copydoc Base::Props::save
	 */
	void save(ptree & pt)
	{
		pt.put("minSegmentArea", minSegmentArea);
		pt.put("minVariance", minVariance);
	}
Ejemplo n.º 30
0
	/*!
	 * \copydoc Base::Props::save
	 */
	void save(ptree & pt)
	{
		pt.put("type", type2str(type));
		pt.put("iterations", iterations);
	}