Пример #1
0
const Options InPlaceReprojection::getDefaultOptions() const
{
    Options options;
    Option in_srs("in_srs", std::string(""),"Input SRS to use to override -- fetched from previous stage if not present");
    Option out_srs("out_srs", std::string(""), "Output SRS to reproject to");
    Option x("x_dim", std::string("X"), "Dimension name to use for 'X' data");
    Option y("y_dim", std::string("Y"), "Dimension name to use for 'Y' data");
    Option z("z_dim", std::string("Z"), "Dimension name to use for 'Z' data");
    Option x_scale("scale_x", 1.0f, "Scale for output X data in the case when 'X' dimension data are to be scaled.  Defaults to '1.0'.  If not set, the Dimensions's scale will be used");
    Option y_scale("scale_y", 1.0f, "Scale for output Y data in the case when 'Y' dimension data are to be scaled.  Defaults to '1.0'.  If not set, the Dimensions's scale will be used");
    Option z_scale("scale_z", 1.0f, "Scale for output Z data in the case when 'Z' dimension data are to be scaled.  Defaults to '1.0'.  If not set, the Dimensions's scale will be used");
    Option x_offset("offset_x", 0.0f, "Offset for output X data in the case when 'X' dimension data are to be scaled.  Defaults to '0.0'.  If not set, the Dimensions's scale will be used");
    Option y_offset("offset_y", 0.0f, "Offset for output Y data in the case when 'Y' dimension data are to be scaled.  Defaults to '0.0'.  If not set, the Dimensions's scale will be used");
    Option z_offset("offset_z", 0.0f, "Offset for output Z data in the case when 'Z' dimension data are to be scaled.  Defaults to '0.0'.  If not set, the Dimensions's scale will be used");
    Option ignore_old_dimensions("ignore_old_dimensions", true, "Mark old, unprojected dimensions as ignored");
    Option do_offset_z("do_offset_z", false, "Should we re-offset Z data");    
    options.add(in_srs);
    options.add(out_srs);
    options.add(x);
    options.add(y);
    options.add(z);
    options.add(x_scale);
    options.add(y_scale);
    options.add(z_scale);
    options.add(x_offset);
    options.add(y_offset);
    options.add(z_offset);
    options.add(ignore_old_dimensions);
    options.add(do_offset_z);

    return options;
}
Пример #2
0
	void initialize() override
	{
		const auto size = windowDimensions();
		linear_scale<float, float> window_scale(0, 1000, 0, size.x);
		linear_scale<float, float> lower_bottom(0, size.x, 5 * size.y / 6, 5 * size.y / 6);
		linear_scale<float, float> lower_top(0, size.x, 2 * size.y / 3, size.y / 6);
		linear_scale<float, float> upper_bottom(0, size.x, size.y / 3, 5 * size.y / 6);
		linear_scale<float, float> upper_top(0, size.x, size.y / 6, size.y / 6);
		linear_scale<float, float> x_scale(0, std::sqrt(size.x), 0, size.x);
		linear_color_scale<float> color_scale(0, size.x, sf::Color(128, 128, 128), sf::Color::Black);
		linear_scale<float, float> size_scale(0, size.x, 1, 6);

		const unsigned num_rects(15);
		sf::RectangleShape rect(sf::Vector2f(window_scale(100), window_scale(20)));
		rect.setOrigin(window_scale(50), window_scale(10));
		rect.setFillColor(sf::Color::Black);
		rect.setOutlineColor(sf::Color::White);
		rect.setOutlineThickness(window_scale(-1));

		sf::Vector2f top_left(0, 0);
		sf::Vector2f bottom_right(std::sqrt(size.x), size.y);
		maxProgress(num_rects);
		for(unsigned i = 0; i < num_rects; ++i)
		{
			float x = x_scale(randuniform(0, std::sqrt(size.x)));
			float scale = size_scale(x);
			rect.setScale(scale, scale);
			rect.setOutlineThickness(window_scale(-1)/scale);
			float y = linear_scale<float, float>(0, size.y, upper_top(x), upper_bottom(x))(randuniform(0, size.y));
			rect.setFillColor(color_scale(x));
			rect.setPosition(x, y);
			rects.push_back(rect);
			addProgress(0.5);
			y = linear_scale<float, float>(0, size.y, lower_top(x), lower_bottom(x))(randuniform(0, size.y));
			rect.setFillColor(sf::Color::Black);
			rect.setPosition(x, y);
			rects.push_back(rect);
			addProgress(0.5);
		}
		std::sort(rects.begin(), rects.end(), [](const sf::RectangleShape& lhs, const sf::RectangleShape& rhs)
		{
			return lhs.getPosition().x > rhs.getPosition().x;
		});

	}