Exemplo n.º 1
0
scigraphics::textStyle scigraphics::legend::updateLegendRectangle( painter &Painter, const graphCollection &Graphics )
{
  if ( getRectangle() == InitLegendRectangle )
    setRectangle( createInitialRectangle(Painter) );

  std::list<std::string> Legends = legendsList(Graphics);
  if ( Legends.empty() )
  {
    setRectangle( getRectangle().leftUp(), getRectangle().leftUp() );
    return getLegendTextStyle();
  }

  textStyle Style = getLegendTextStyle();
  legendSize LegendSizes;

  while ( true )
  {
    LegendSizes = sizesForLegendRectangle( Painter, Style, Graphics );
    if ( Style.getFontSize() <= minFontSize() )
      break;
    if ( LegendSizes.height() < Painter.height() )
      break;
    if ( Style.getFontSize() <= minFontSize() )
      break;
    Style.setFontSize( Style.getFontSize() - 1 );
  }

  setRectangleFromLegendSize( Painter, LegendSizes );
  return Style;
}
Exemplo n.º 2
0
		void RLEChunk::setRectangle(const math::Vector<3, int>& min, const math::Vector<3, int>& max, blocks::Block block) {
			int segmentIdMin(getSegment(min[math::Dimension::Y])),
				segmentIdMax(getSegment(max[math::Dimension::Y]));

			if (segmentIdMin == segmentIdMax) {
				auto first = m_compression.getFirst();
				auto second = m_compression.getSecond();
				auto third = m_compression.getThird();

				auto minPos = min;
				minPos[math::Dimension::Y] -= SEGMENT_HEIGHT * segmentIdMin;

				auto maxPos = max;
				maxPos[math::Dimension::Y] -= SEGMENT_HEIGHT * segmentIdMin;

				auto tmax = maxPos[third] + 1;
				auto smax = maxPos[second] + 1;

				auto rowSize = maxPos[first] - minPos[first];

				auto& segment = m_storage[segmentIdMin];
				auto pos = math::Vector<3, int>(minPos);

				for (pos[third]; pos[third] < tmax; pos[third]++) {
					for (pos[second] = minPos[second]; pos[second] < smax; pos[second]++) {
						auto rowMin = flatten(pos);
						segment.setValues(rowMin, rowMin + rowSize, block);
					}
				}
			}
			else {
				auto smax = max;
				smax[math::Dimension::Y] = ((segmentIdMin + 1) * SEGMENT_HEIGHT) - 1;

				auto smin = min;
				smin[math::Dimension::Y] = ((segmentIdMin) * SEGMENT_HEIGHT);

				// Begining Section.
				setRectangle(min, smax, block);

				for (auto index = segmentIdMin + 1; index < segmentIdMax; index++) {
					smax[math::Dimension::Y] += SEGMENT_HEIGHT;
					smin[math::Dimension::Y] += SEGMENT_HEIGHT;

					// Middle Sections
					setRectangle(smin, smax, block);
				}

				// End Section
				smin[math::Dimension::Y] += SEGMENT_HEIGHT;
				setRectangle(smin, max, block);
			}
		}
Exemplo n.º 3
0
//==============================================================================
void DrawableRectangle::refreshFromValueTree (const ValueTree& tree, ComponentBuilder& builder)
{
    ValueTreeWrapper v (tree);
    setComponentID (v.getID());

    refreshFillTypes (v, builder.getImageProvider());
    setStrokeType (v.getStrokeType());
    setRectangle (v.getRectangle());
    setCornerSize (v.getCornerSize());
}
Exemplo n.º 4
0
        void Array3DChunk::setRectangle(const math::Vector<3, int>& min, const math::Vector<3, int>& max, blocks::Block block) {
            auto segmentIdMin = getSegment(min[math::Dimension::Y]);
            auto segmentIdMax = getSegment(max[math::Dimension::Y]);

            if (segmentIdMin == segmentIdMax) { // SUSPECTED SEGFAULT BOMB...
                //std::cout << "ENTERING HORRIBLE LOOP" << std::endl;
				//std::cout << IChunk::SEGMENT_HEIGHT << "segment : " << m_storage.size() << "pos: [" << m_storage[7].size() << "," << m_storage[7][IChunk::SEGMENT_WIDTH].size() << "]" << std::endl;
				auto ly = math::fastMod<IChunk::SEGMENT_HEIGHT>(min[math::Dimension::Y]);
				auto hy = math::fastMod<IChunk::SEGMENT_HEIGHT>(max[math::Dimension::Y]);

				for (auto x = min[math::Dimension::X]; x <= max[math::Dimension::X]; x++) {
                    for (auto y = ly; y <= hy; y++) {
						//std::cout << "segment : " << segmentIdMax << "pos: [" << x << "," << y << "]" << std::endl;
						std::fill(m_storage->at(segmentIdMax)[x][y].begin() + min[math::Dimension::Z], m_storage->at(segmentIdMax)[x][y].begin() + max[math::Dimension::Z] + 1, block);
						//std::cout << "I SURVIVED THAT TIME" << std::endl;
                    }
                }
            }
            else {
                auto smax = max;
                smax[math::Dimension::Y] = ((segmentIdMin + 1) * SEGMENT_HEIGHT) - 1;

                auto smin = min;
                smin[math::Dimension::Y] = ((segmentIdMin)* SEGMENT_HEIGHT);

                // Begining Section.
                setRectangle(min, smax, block);

                for (auto index = segmentIdMin + 1; index < segmentIdMax; index++) {
                     smax[math::Dimension::Y] += SEGMENT_HEIGHT;
                     smin[math::Dimension::Y] += SEGMENT_HEIGHT;

                     // Middle Sections
                     setRectangle(smin, smax, block);
                }

                // End Section
                smin[math::Dimension::Y] += SEGMENT_HEIGHT;
                setRectangle(smin, max, block);
            }
        }
Exemplo n.º 5
0
 virtual void onDraw(int loops, SkCanvas* canvas) {
     SkDEBUGCODE(this->validateBounds(canvas));
     SkPaint paint;
     this->setupPaint(&paint);
     for (int i = 0; i < N; i++) {
         SkRect current;
         setRectangle(current, i);
         for (int j = 0; j < loops * gmailScrollingRectSpec[i*3]; j++) {
             canvas->drawRect(current, paint);
         }
     }
 }
Exemplo n.º 6
0
void scigraphics::legend::setRectangleFromLegendSize( painter &Painter, const legendSize &LegendSize )
{
  wpoint LeftUp = getRectangle().leftUp();
  wpoint RightDown( LeftUp.x() + LegendSize.width(), LeftUp.y() - LegendSize.height() );

  wrectangle LegendRectangle( LeftUp, RightDown );

  if ( LegendRectangle.width() < Painter.plotWidth() )
    while ( LegendRectangle.right() > Painter.plotWidth() ) 
      LegendRectangle.moveX( -1 );

  if ( LegendRectangle.height() < Painter.plotHeight() )
    while ( LegendRectangle.down() < 0 )
      LegendRectangle.moveY( +1 );

  setRectangle( LegendRectangle );
}
Exemplo n.º 7
0
Button::Button(int x, int y, int width, int height, ALLEGRO_FONT *buttonFont, ALLEGRO_COLOR inactiveColor, ALLEGRO_COLOR activeColor, ALLEGRO_COLOR textColor, ALLEGRO_COLOR borderColor, QString title, int value)
{
    setRectangle(x, y, width, height);

    setTitle(title);

    setColors(inactiveColor, activeColor, textColor, borderColor);

    setValue(value);

    m_buttonFont = buttonFont;

    if (!m_buttonFont){
        qDebug() << "Could not load font";
    }
    qDebug() << "Created Button";
    this->m_prevClick = 0;
}
Exemplo n.º 8
0
void GraphicImageEffectElement::updateImage()
{
	minImage = modImage.scaled(50, 50, Qt::KeepAspectRatio/*, Qt::SmoothTransformation*/);
	setRectangle(minImage.rect());
	update();
}
Exemplo n.º 9
0
void scigraphics::floatRectangle::setRectangle( const wpoint &A, const wpoint &B ) 
{ 
  setRectangle( wrectangle(A,B) ); 
}
Exemplo n.º 10
0
	void DebugGuiWindowDebugProp::create( DebugGui& debugGui )
	{
		m_inputAction	= InputAction_Invalid;
		m_inputTimer	= 0.0;
		m_holdTimer		= 0.0;
		m_pInputNode	= nullptr;
		m_pSelectedNode	= nullptr;

		m_baseLayout.create();
		m_baseLayout.setExpandChildren( false );

		DebugGuiWindow::create( debugGui, "Debug Properties", m_baseLayout );

		LinkedList< DebugProp >& debugProperties = debugprop::getProperties();

		SizedArray<string> folderNames;
		folderNames.create( debugProperties.getCount() * 5u );

		for (DebugProp& prop : debugProperties)
		{
			string pathName;
			pathName += prop.getModule();
			pathName += "/";
			pathName += prop.getFullName();
			pathName = pathName.toLower();

			int currentIndex = 0;
			while ( currentIndex < (int)pathName.getLength() )
			{
				int nextIndex = pathName.indexOf( '/', currentIndex );
				if ( nextIndex == -1 )
				{
					break;
				}

				const string folderName = pathName.subString( 0, nextIndex );
				if ( folderNames.getIndexOf( folderName ) == TIKI_SIZE_T_MAX )
				{
					folderNames.push( folderName );
				}

				currentIndex = nextIndex + 1;
			}

		}

		m_folderNodes.create( folderNames.getCount() );
		m_propNodes.create( debugProperties.getCount() );

		for (uint folderIndex = 0u; folderIndex < m_folderNodes.getCount(); ++folderIndex)
		{
			const string& name = folderNames[ folderIndex ];
			TreeFolderNode& node = m_folderNodes[ folderIndex ];

			node.id		= folderIndex;
			node.type	= TreeNodeType_Folder;

			int lastIndex = name.lastIndexOf( '/' ) + 1;
			const string nodeName = name.subString( lastIndex, name.getLength() - lastIndex );

			node.fullLayout.create();
			node.nodeLayout.create();
			node.spaceLayout.create();
			node.chilrenLayout.create();

			setLayoutParameters( node.fullLayout );
			setLayoutParameters( node.nodeLayout );
			setLayoutParameters( node.spaceLayout );
			setLayoutParameters( node.chilrenLayout );

			node.expandButton.create( "+" );
			node.nameLabel.create( nodeName.cStr() );

			node.nodeLayout.addChildControl( &node.expandButton );
			node.nodeLayout.addChildControl( &node.nameLabel );

			node.spacer.create( vector::create( 25.0f, 0.0f ) );

			node.spaceLayout.addChildControl( &node.spacer );
			node.spaceLayout.addChildControl( &node.chilrenLayout );

			node.fullLayout.addChildControl( &node.nodeLayout );
			node.fullLayout.addChildControl( &node.spaceLayout );

			node.parentIndex = TIKI_SIZE_T_MAX;
			if ( lastIndex == 0 )
			{
				m_baseLayout.addChildControl( &node.fullLayout );
			}
			else
			{
				const string parentName = name.subString( 0, lastIndex - 1 );
				for (uint parentIndex = 0u; parentIndex < folderIndex; ++parentIndex)
				{
					if ( folderNames[ parentIndex ] == parentName )
					{
						node.parentIndex = parentIndex;
					}
				}
				TIKI_ASSERT( node.parentIndex != TIKI_SIZE_T_MAX );
			}
		}

		uint propIndex = 0;
		for (DebugProp& prop : debugProperties)
		{
			TreePropNode& node = m_propNodes[ propIndex ];

			node.id			= propIndex;
			node.type		= TreeNodeType_Property;
			node.pProperty	= &prop;

			node.nodeLayout.create();
			setLayoutParameters( node.nodeLayout );

			node.nameLabel.create( prop.getName() );
			node.valueAlignment.create( DebugGuiAlignment::OrientationFlags_X, vector::create( 400.0f, 0.0f ) );
			setDebugPropText( node.valueLabel, prop );

			node.nodeLayout.addChildControl( &node.nameLabel );
			node.nodeLayout.addChildControl( &node.valueAlignment );
			node.nodeLayout.addChildControl( &node.valueLabel );

			string pathName;
			pathName += prop.getModule();
			pathName += "/";
			pathName += prop.getFullName();
			pathName = pathName.toLower();
			pathName = pathName.subString( 0, pathName.lastIndexOf( '/' ) );

			node.parentIndex = TIKI_SIZE_T_MAX;
			for (uint parentIndex = 0u; parentIndex < m_folderNodes.getCount(); ++parentIndex)
			{
				if (folderNames[ parentIndex ] == pathName )
				{
					node.parentIndex = parentIndex;
				}
			}
			TIKI_ASSERT( node.parentIndex != TIKI_SIZE_T_MAX );

			propIndex++;
		}

		folderNames.dispose();

		setRectangle( Rectangle( 20.0, 40.0f, 200.0f, 400.0f ) );
	}
Exemplo n.º 11
0
/*---------------------------------------------------------------------*//**
	画面解像度変更に対応する
**//*---------------------------------------------------------------------*/
void HeaderPanel::complyChangeScreenSize()
{
	// 現在の画面解像度における位置調整
	RectF32 rect(RECT_THIS);
	setRectangle(&rect);
}
Exemplo n.º 12
0
Window::Window()
{
    setWindowTitle(tr("CSC 205 Assignment 1"));

    // define our drawing widget (see GLWidget.h / .cpp)
    glWidget = new GLWidget;

    menubar = new QMenuBar;
    QMenu *file = new QMenu("&File");
    QMenu *edit = new QMenu("&Edit");
    menubar->addMenu(file);
    menubar->addMenu(edit);

    QAction *quitAct = new QAction(tr("&Close"), this);
    file->addAction(quitAct);

    // define our color sliders
    hSlider = new QSlider(Qt::Horizontal);
    sSlider = new QSlider(Qt::Horizontal);
    vSlider = new QSlider(Qt::Horizontal);

    rSlider = new QSlider(Qt::Horizontal);
    gSlider = new QSlider(Qt::Horizontal);
    bSlider = new QSlider(Qt::Horizontal);

    // added slider
    bSizeSlider = new QSlider(Qt::Horizontal);

    // configure our color sliders
    hSlider->setRange(0,360);
    hSlider->setTickInterval(360/8);
    hSlider->setTickPosition(QSlider::TicksBelow);
    hSlider->setMinimumWidth(200);


    sSlider->setRange(0,100);
    sSlider->setTickInterval(100/8);
    sSlider->setTickPosition(QSlider::TicksBelow);

    vSlider->setRange(0,100);
    vSlider->setTickInterval(100/8);
    vSlider->setTickPosition(QSlider::TicksBelow);

    rSlider->setRange(0,255);
    rSlider->setTickInterval(255/8);
    rSlider->setTickPosition(QSlider::TicksBelow);

    gSlider->setRange(0,255);
    gSlider->setTickInterval(255/8);
    gSlider->setTickPosition(QSlider::TicksBelow);

    bSlider->setRange(0,255);
    bSlider->setTickInterval(255/8);
    bSlider->setTickPosition(QSlider::TicksBelow);

    bSizeSlider->setRange(2,80);
    bSizeSlider->setTickInterval(80/6);
    bSizeSlider->setTickPosition(QSlider::TicksBelow);

    // labels for our sliders
    hLabel = new QLabel("0");
    sLabel = new QLabel("0");
    vLabel = new QLabel("0");

    rLabel = new QLabel("0");
    gLabel = new QLabel("0");
    bLabel = new QLabel("0");

    bSizeLabel = new QLabel("2");


    // The main (biggest) layout for our screen is a horizontal layout
    // This means items added to this layout will be added horizontally
    QHBoxLayout *mainLayout = new QHBoxLayout;

    // add our drawing widget as the first (leftmost) widget in our horizontal layout
    mainLayout->addWidget(glWidget);

    // our sliders are going to be in a vertical column
    QVBoxLayout *sliderLayout = new QVBoxLayout;
    sliderLayout->setAlignment(Qt::AlignTop);
    sliderLayout->setSizeConstraint(QLayout::SizeConstraint());

    // each slider has 2 labels below it in a horizontal box
    QHBoxLayout *hLabels = new QHBoxLayout;
    // first is just a name that never changes
    hLabels->addWidget(new QLabel(QString("Hue")));
    // we keep a reference to the next one because it's the label we're going to use to show
    // the value of this slider, and we'll need to update it accordingly
    hLabels->addWidget(hLabel);


    QHBoxLayout *sLabels = new QHBoxLayout;
    sLabels->addWidget(new QLabel(QString("Saturation")));
    sLabels->addWidget(sLabel);

    QHBoxLayout *vLabels = new QHBoxLayout;
    vLabels->addWidget(new QLabel(QString("Value")));
    vLabels->addWidget(vLabel);

    QHBoxLayout *rLabels = new QHBoxLayout;
    rLabels->addWidget(new QLabel(QString("Red")));
    rLabels->addWidget(rLabel);

    QHBoxLayout *gLabels = new QHBoxLayout;
    gLabels->addWidget(new QLabel(QString("Green")));
    gLabels->addWidget(gLabel);

    QHBoxLayout *bLabels = new QHBoxLayout;
    bLabels->addWidget(new QLabel(QString("Blue")));
    bLabels->addWidget(bLabel);

    QHBoxLayout *bSizeLabels = new QHBoxLayout;
    bSizeLabels->addWidget(new QLabel(QString("Brush Size")));
    bSizeLabels->addWidget(bSizeLabel);


    // we're going to have a box that shows the currently selected color
    // this is that box
    colorFrame = new QFrame;
    colorFrame->setFrameStyle(QFrame::Panel | QFrame::Raised);
    colorFrame->setLineWidth(2);
    colorFrame->setAutoFillBackground(true);
    colorFrame->setMinimumHeight(75);
    colorFrame->setMinimumWidth(75);

    // this is how we change the color of a QFrame
    QPalette pal = colorFrame->palette();
    pal.setColor(colorFrame->backgroundRole(), QColor(0,0,0));
    colorFrame->setPalette(pal);

    // add all of our sliders and our color box to our vertical slider layout
    sliderLayout->addWidget(hSlider);
    sliderLayout->addLayout(hLabels);

    sliderLayout->addWidget(sSlider);
    sliderLayout->addLayout(sLabels);

    sliderLayout->addWidget(vSlider);
    sliderLayout->addLayout(vLabels);

    sliderLayout->addWidget(colorFrame);

    sliderLayout->addWidget(rSlider);
    sliderLayout->addLayout(rLabels);

    sliderLayout->addWidget(gSlider);
    sliderLayout->addLayout(gLabels);

    sliderLayout->addWidget(bSlider);
    sliderLayout->addLayout(bLabels);

    sliderLayout->addSpacing(30);
    sliderLayout->addWidget(bSizeSlider);
    sliderLayout->addLayout(bSizeLabels);

    // add the slider layout to the main layout
    mainLayout->addLayout(sliderLayout);

    QGridLayout *buttonsLayout = new QGridLayout;
    QPushButton *rectButton[14];

    //declare buttons
    rectButton[0] = new QPushButton("Brush 1");
    rectButton[1] = new QPushButton("Brush 2");
    rectButton[2] = new QPushButton("Brush 3");
    rectButton[3] = new QPushButton("Brush 4");
    rectButton[4] = new QPushButton("Bresenham's Line");
    rectButton[5] = new QPushButton("Wu's Line");
    rectButton[6] = new QPushButton("Rectangle");
    rectButton[7] = new QPushButton("Filled Rectangle");
    rectButton[8] = new QPushButton("Circle");
    rectButton[9] = new QPushButton("Filled Circle");
    rectButton[10] = new QPushButton("Polygon");
    rectButton[11] = new QPushButton("Filled Polygon");
    rectButton[12] = new QPushButton("Edit a Vertex");
    rectButton[13] = new QPushButton("Clear");

    for (int i=0; i < 14; i++)
        buttonsLayout->addWidget(rectButton[i], i/2, i%2, Qt::AlignTop);

    sliderLayout->addLayout(buttonsLayout);
    setLayout(mainLayout);

    /*  Connections between our sliders and their labels */
    connect(hSlider, SIGNAL(valueChanged(int)), hLabel, SLOT(setNum(int)));
    connect(bSizeSlider, SIGNAL(valueChanged(int)), bSizeLabel, SLOT(setNum(int)));

    // had to use a special method for saturation and value because sliders go from 0 - 100 and we want 0 - 1
    connect(sSlider, SIGNAL(valueChanged(int)), this, SLOT(updateSVal(int)));
    connect(vSlider, SIGNAL(valueChanged(int)), this, SLOT(updateVVal(int)));

    connect(rSlider, SIGNAL(valueChanged(int)), rLabel, SLOT(setNum(int)));
    connect(gSlider, SIGNAL(valueChanged(int)), gLabel, SLOT(setNum(int)));
    connect(bSlider, SIGNAL(valueChanged(int)), bLabel, SLOT(setNum(int)));

    connect(hSlider, SIGNAL(valueChanged(int)), this, SLOT(hsvChanged()));
    connect(sSlider, SIGNAL(valueChanged(int)), this, SLOT(hsvChanged()));
    connect(vSlider, SIGNAL(valueChanged(int)), this, SLOT(hsvChanged()));

    connect(rSlider, SIGNAL(valueChanged(int)), this, SLOT(rgbChanged()));
    connect(gSlider, SIGNAL(valueChanged(int)), this, SLOT(rgbChanged()));
    connect(bSlider, SIGNAL(valueChanged(int)), this, SLOT(rgbChanged()));

    connect(bSizeSlider, SIGNAL(valueChanged(int)), glWidget, SLOT(setSize(int)));

    connect(this, SIGNAL(colorChanged(RGBColor)), glWidget, SLOT(setColor(RGBColor)));

    connect(rectButton[0], SIGNAL(clicked()), glWidget, SLOT(setBrush1() ));
    connect(rectButton[1], SIGNAL(clicked()), glWidget, SLOT(setBrush2() ));
    connect(rectButton[2], SIGNAL(clicked()), glWidget, SLOT(setBrush3() ));
    connect(rectButton[3], SIGNAL(clicked()), glWidget, SLOT(setBrush4() ));
    connect(rectButton[4], SIGNAL(clicked()), glWidget, SLOT(setBresenhamLine() ));
    connect(rectButton[5], SIGNAL(clicked()), glWidget, SLOT(setWuLine() ));
    connect(rectButton[6], SIGNAL(clicked()), glWidget, SLOT(setRectangle() ));
    connect(rectButton[7], SIGNAL(clicked()), glWidget, SLOT(setFillRectangle() ));
    connect(rectButton[8], SIGNAL(clicked()), glWidget, SLOT(setCircle() ));
    connect(rectButton[9], SIGNAL(clicked()), glWidget, SLOT(setFillCircle() ));
    connect(rectButton[10], SIGNAL(clicked()), glWidget, SLOT(setPolygon() ));
    connect(rectButton[11], SIGNAL(clicked()), glWidget, SLOT(setFillPolygon() ));
    connect(rectButton[12], SIGNAL(clicked()), glWidget, SLOT(setEditVertex() ));
    connect(rectButton[13], SIGNAL(clicked()), glWidget, SLOT(clear() ));

    connect(quitAct, SIGNAL(triggered()), this, SLOT(close()));
}
Exemplo n.º 13
0
int main(int argc, const char* argv[])
{
    if(argc != 5)
        return EXIT_FAILURE;

    SDL_Surface* p_screen = init_map(TABLE_LENGTH/GRID_SIZE, TABLE_WIDTH/GRID_SIZE, 2);
    //Create the table
    node_s ** p_table = NULL;
    //memory allocation
    p_table = createTable(TABLE_LENGTH/GRID_SIZE , TABLE_WIDTH/GRID_SIZE);

    //initialize the table
    initialiseTable(p_table, TABLE_LENGTH/GRID_SIZE, TABLE_WIDTH/GRID_SIZE);

    uint16_t robot_length = 30;
    uint16_t robot_width = 30;
    uint16_t half_width = robot_width/2 + (GRID_SIZE-1);
    uint8_t grid_half_width = (half_width / GRID_SIZE) + 1;
    uint16_t half_diag = (uint16_t) (sqrtf((robot_length * robot_length) + (robot_width * robot_width)) / 2) + (GRID_SIZE-1);
    uint8_t grid_half_diag = half_diag / GRID_SIZE;

    //Fill the table

    //expand walls soft
    setRectangle(p_table, TABLE_LENGTH / GRID_SIZE, grid_half_diag, 0, 0, SOFT_OBSTACLE);
    setRectangle(p_table, TABLE_LENGTH / GRID_SIZE, grid_half_diag, 0, TABLE_WIDTH/GRID_SIZE - grid_half_diag, SOFT_OBSTACLE);
    setRectangle(p_table, grid_half_diag, TABLE_WIDTH / GRID_SIZE, 0, 0, SOFT_OBSTACLE);
    setRectangle(p_table, grid_half_diag, TABLE_WIDTH / GRID_SIZE, TABLE_LENGTH / GRID_SIZE - grid_half_diag, 0, SOFT_OBSTACLE);

    // Expand dune soft
    setRectangle(p_table, grid_half_diag, 20/GRID_SIZE, 80/GRID_SIZE - grid_half_diag, 0/GRID_SIZE, SOFT_OBSTACLE);
    setRectangle(p_table, grid_half_diag, 20/GRID_SIZE, 80/GRID_SIZE + 1, 0/GRID_SIZE, SOFT_OBSTACLE);
    setCircle(p_table, 81/GRID_SIZE, 20/GRID_SIZE, (half_diag + 1) / GRID_SIZE, SOFT_OBSTACLE);
    setRectangle(p_table, grid_half_diag, 20/GRID_SIZE, 220/GRID_SIZE - grid_half_diag, 0/GRID_SIZE, SOFT_OBSTACLE);
    setRectangle(p_table, grid_half_diag, 20/GRID_SIZE, 220/GRID_SIZE + 1, 0/GRID_SIZE, SOFT_OBSTACLE);
    setCircle(p_table, 221/GRID_SIZE, 20/GRID_SIZE, (half_diag + 1) / GRID_SIZE, SOFT_OBSTACLE);

    //Central T soft
    setRectangle(p_table, 120/GRID_SIZE, grid_half_diag, 90/GRID_SIZE, 75/GRID_SIZE - grid_half_diag, SOFT_OBSTACLE);
    setRectangle(p_table, 120/GRID_SIZE, grid_half_diag, 90/GRID_SIZE, 75/GRID_SIZE + 1, SOFT_OBSTACLE);
    setCircle(p_table, 90/GRID_SIZE, 76/GRID_SIZE, (half_diag + 1) / GRID_SIZE, SOFT_OBSTACLE);
    setCircle(p_table, 210/GRID_SIZE, 76/GRID_SIZE, (half_diag + 1) / GRID_SIZE, SOFT_OBSTACLE);
    setRectangle(p_table, grid_half_diag, 60/GRID_SIZE, 147/GRID_SIZE - grid_half_diag, 75/GRID_SIZE, SOFT_OBSTACLE);
    setRectangle(p_table, grid_half_diag, 60/GRID_SIZE, 147/GRID_SIZE + 1, 75/GRID_SIZE, SOFT_OBSTACLE);
    setCircle(p_table, 150/GRID_SIZE, 135/GRID_SIZE, (half_diag + 2) / GRID_SIZE, SOFT_OBSTACLE);

    //iles soft
    setCircle(p_table, 0/GRID_SIZE, 200/GRID_SIZE, (25 + half_diag)/GRID_SIZE, SOFT_OBSTACLE);
    setCircle(p_table, 300/GRID_SIZE, 200/GRID_SIZE, (25 + half_diag)/GRID_SIZE, SOFT_OBSTACLE);

    // Expand walls forbidden
    setRectangle(p_table, TABLE_LENGTH / GRID_SIZE, grid_half_width, 0, 0, FORBIDDEN);
    setRectangle(p_table, TABLE_LENGTH / GRID_SIZE, grid_half_width, 0, TABLE_WIDTH/GRID_SIZE - grid_half_width, FORBIDDEN);
    setRectangle(p_table, grid_half_width, TABLE_WIDTH / GRID_SIZE, 0, 0, FORBIDDEN);
    setRectangle(p_table, grid_half_width, TABLE_WIDTH / GRID_SIZE, TABLE_LENGTH / GRID_SIZE - grid_half_width, 0, FORBIDDEN);

    //expand dune forbidden
    setRectangle(p_table, grid_half_width, 20/GRID_SIZE, 80/GRID_SIZE - grid_half_width, 0/GRID_SIZE, FORBIDDEN);
    setRectangle(p_table, grid_half_width, 20/GRID_SIZE, 80/GRID_SIZE + 1, 0/GRID_SIZE, FORBIDDEN);
    setCircle(p_table, 81/GRID_SIZE, 20/GRID_SIZE, (half_width + 1) / GRID_SIZE, FORBIDDEN);
    setRectangle(p_table, grid_half_width, 20/GRID_SIZE, 220/GRID_SIZE - grid_half_width, 0/GRID_SIZE, FORBIDDEN);
    setRectangle(p_table, grid_half_width, 20/GRID_SIZE, 220/GRID_SIZE + 1, 0/GRID_SIZE, FORBIDDEN);
    setCircle(p_table, 221/GRID_SIZE, 20/GRID_SIZE, (half_width + 1) / GRID_SIZE, FORBIDDEN);

    //Central T forbidden
    setRectangle(p_table, 120/GRID_SIZE, grid_half_width, 90/GRID_SIZE, 75/GRID_SIZE - grid_half_width, FORBIDDEN);
    setRectangle(p_table, 120/GRID_SIZE, grid_half_width, 90/GRID_SIZE, 75/GRID_SIZE + 1, FORBIDDEN);
    setCircle(p_table, 90/GRID_SIZE, 76/GRID_SIZE, (half_width + 1) / GRID_SIZE, FORBIDDEN);
    setCircle(p_table, 210/GRID_SIZE, 76/GRID_SIZE, (half_width + 1) / GRID_SIZE, FORBIDDEN);
    setRectangle(p_table, grid_half_width, 60/GRID_SIZE, 147/GRID_SIZE - grid_half_width, 75/GRID_SIZE, FORBIDDEN);
    setRectangle(p_table, grid_half_width, 60/GRID_SIZE, 147/GRID_SIZE + 1, 75/GRID_SIZE, FORBIDDEN);
    setCircle(p_table, 150/GRID_SIZE, 135/GRID_SIZE, (half_width + 2) / GRID_SIZE, FORBIDDEN);

    //iles forbidden
    setCircle(p_table, 0/GRID_SIZE, 200/GRID_SIZE, (25 + half_width)/GRID_SIZE, FORBIDDEN);
    setCircle(p_table, 300/GRID_SIZE, 200/GRID_SIZE, (25 + half_width)/GRID_SIZE, FORBIDDEN);

    //dune obstacle
    setRectangle(p_table, 2/GRID_SIZE, 20/GRID_SIZE, 80/GRID_SIZE, 0/GRID_SIZE, OBSTACLE);
    setRectangle(p_table, 2/GRID_SIZE, 20/GRID_SIZE, 220/GRID_SIZE, 0/GRID_SIZE, OBSTACLE);

    // central T obstacle
    setRectangle(p_table, 120/GRID_SIZE, 2/GRID_SIZE, 90/GRID_SIZE, 75/GRID_SIZE, OBSTACLE);
    setRectangle(p_table, 6/GRID_SIZE, 60/GRID_SIZE, 147/GRID_SIZE, 75/GRID_SIZE, OBSTACLE);

    //iles obstacle
    setCircle(p_table, 0/GRID_SIZE, 200/GRID_SIZE, 25/GRID_SIZE, OBSTACLE);
    setCircle(p_table, 300/GRID_SIZE, 200/GRID_SIZE, 25/GRID_SIZE, OBSTACLE);

    if(!setStartNode(p_table, atoi(argv[1]), atoi(argv[2])))
        if(!setTargetNode(p_table, atoi(argv[3]), atoi(argv[4])))
            startMainLoop(p_table, p_screen, 2);

    draw_map(p_table, TABLE_LENGTH/GRID_SIZE, TABLE_WIDTH/GRID_SIZE, 2, p_screen);
    sdl_pause();
    quit_map();
    return EXIT_SUCCESS;
}