Ejemplo n.º 1
0
bool IrisWind::SetActiveScaling (long lZoom)
{
ObjContainer OC (0, 0, 0, 0);
ObjContainer oldOC = DBO().GetExtend();		// alten Ausschnitt merken
bool fResult = false;
Rectangle rcC (0, 0, 0, 0);

	for (int i = 0; i < 2; i++) {
		rcC = CanvasRect();

	Rectangle rc;
	
		if (NULL != m_pDRO) {
			rc = ((DragRectangleObject *)m_pDRO) -> GetRect();

		// Koordinaten kippen
		CoOrd tmpC = CoOrd(rc.Bottom() - rc.Top());
		
			rc.Bottom() = CoOrd(rc.Top() - tmpC);
		} else
			rc = rcC;
				
		fResult = DBO().SetActiveScaling (lZoom, rc, rcC, OC);
		if (!fResult) break;
	
	// neuen Ausschnitt einstellen
		SetExtend (OC, lZoom);

	// bei Bedarf ScrollBars einblenden und initialisieren
		if (!InitWndScrollBars())
			break;		// einmal reicht, wenn Scrollbars nicht geändert wurden
	}

// wenn Erfolgreich, dann alles neu einstellen
	if (fResult) {
		DELETE_OBJ (m_pDRO);

	// Übersichtsfenster bedienen
		if (OverViewCFlag && pOverView) 
			pOverView -> SetActVP (CanvasRect());
		actClip.Push (oldOC);

	// neu zeichnen
		LegendToRepaint = true;
		m_fRePaintFlag = true;
		RePaint();
	}

return fResult;
}
Ejemplo n.º 2
0
CoOrd Tile::get_neighbour(TileDir dir) const {
    switch (dir) {
        case HEX_WEST:
            return this->nei_west;
        case HEX_NWEST:
            return this->nei_nwest;
        case HEX_SWEST:
            return this->nei_swest;
        case HEX_EAST:
            return this->nei_east;
        case HEX_SEAST:
            return this->nei_seast;
        case HEX_NEAST:
            return this->nei_neast;
        default :
            return CoOrd();
    }
}
Ejemplo n.º 3
0
void Tile::init_neighbours() {
    // Index rules for directions :
    // All x
    // north = y - 2,x
    // northwest = (y%2==0) ? y-1, x-1  : y-1, x
    // southwest = (y%2==0) ? y+1, x-1  : y+1, x
    // south = y + 2,x
    // southeast = (y%2==0) ? y+1, x    : y+1, x+1
    // northeast = (y%2==0) ? y-1, x    : y-1, x+1
    if (y == 0) {
        // No North East neighbours
        // No North West neighbours
        // nei_swest = CoOrd((((x-1)%(Map::_DIMX))), (y+1));
        nei_swest = CoOrd((((x-1))), (y+1));
        nei_seast = CoOrd((x), (y+1));
    // } else if (y == Map::_DIMY - 1) {
    } else if (y == 20 - 1) {
        // No South East neighbours
        // No South West neighbours
        if (y % 2 == 0) {
            // nei_nwest = CoOrd((((x-1)%(Map::_DIMX))), (y-1));
            nei_nwest = CoOrd((((x-1))), (y-1));
            nei_neast = CoOrd((x), (y-1));
        } else {
            nei_nwest = CoOrd((x), (y-1));
            // nei_neast = CoOrd((((x+1)%(Map::_DIMX))), (y-1));
            nei_neast = CoOrd((((x+1))), (y-1));
        }
    } else {
        // All neighbours exist
        if (y % 2 == 0) {
            // nei_nwest = CoOrd((((x-1)%(Map::_DIMX))), (y-1));
            // nei_swest = CoOrd((((x-1)%(Map::_DIMX))), (y+1));
            nei_nwest = CoOrd((((x-1))), (y-1));
            nei_swest = CoOrd((((x-1))), (y+1));
            nei_seast = CoOrd((x), (y+1));
            nei_neast = CoOrd((x), (y-1));
        } else {
            nei_nwest = CoOrd((x), (y-1));
            nei_swest = CoOrd((x), (y+1));
            nei_seast = CoOrd((((x+1))), (y+1));
            nei_neast = CoOrd((((x+1))), (y-1));
            // nei_seast = CoOrd((((x+1)%(Map::_DIMX))), (y+1));
            // nei_neast = CoOrd((((x+1)%(Map::_DIMX))), (y-1));
        }
    }
    // Everyone has EAST and WEST neighbours
    // nei_west = CoOrd((x-1+Map::_DIMX)%(Map::_DIMX), y);
    nei_west = CoOrd((x-1), y);
    // nei_east = CoOrd((x+1)%(Map::_DIMX), y);
    nei_east = CoOrd((x+1), y);
}