Esempio n. 1
0
void CCJKShapeRect::Paint( QPainter *painter )
{
	CJK_D(CCJKShapeRect);
	BeginPaint(painter);
	painter->drawRect(BoundingRect());
	QPen tmpPen = d->pen;
	tmpPen.setColor(d->textColor);
	painter->setPen(tmpPen);
	painter->drawText(BoundingRect(), d->textAlign, d->sText);
	painter->setPen(d->pen);
	EndPaint(painter);
}
Esempio n. 2
0
bool tSceneExtents::Intersects(const tSceneExtents& extents) const
{    
    bool intersects = false;

    QVector<tGeoRect> sourceRects = BoundingRect().GetNormalizedRects();
    QVector<tGeoRect> testRects = extents.BoundingRect().GetNormalizedRects();

    unsigned long numSourceRects = sourceRects.size();
    unsigned long numTestRects = testRects.size();

    unsigned long sourceIndex = 0;

    while (sourceIndex < numSourceRects && intersects == false)
    {
        for (unsigned long testIndex = 0; testIndex < numTestRects; ++testIndex)
        {
            if (sourceRects[sourceIndex].Intersects(testRects[testIndex]))
            {
                intersects = true;
                break;
            }
        }

        ++sourceIndex;
    }

    return intersects;
}
void CStandardNodePositioning::ApplyTo (IRevisionGraphLayout* layout)
{
    // we need access to actual data

    IStandardLayoutNodeAccess* nodeAccess 
        = dynamic_cast<IStandardLayoutNodeAccess*>(layout);
    if (nodeAccess == NULL) 
        return;

    // calculate the displacement for every node (member subTreeShift)

    CSize treeShift (0,0);
    for (index_t i = 0, count = nodeAccess->GetNodeCount(); i < count; ++i)
    {
        CStandardLayoutNodeInfo* node = nodeAccess->GetNode(i);
        if (node->node->GetSource() == NULL)
        {
            // we found a root -> place it

            std::vector<long> columnStarts;
            std::vector<long> ColumnEnds;

            PlaceBranch (node, columnStarts, ColumnEnds);

            // actually move the node rects to thier final position

            ShiftNodes (node, treeShift);
            treeShift.cx = BoundingRect (node).right + 100;
        }
    }
}
Esempio n. 4
0
QPainterPath CCJKShapeRect::GetShape() const
{
	CJK_D(const CCJKShapeRect);
	QPainterPath path = StrokePath(GetPath());
	if (d->brush.style() != Qt::NoBrush)
	{
		QPainterPath tmpPath;
		tmpPath.addRect(BoundingRect());
		path += tmpPath;
	}
	else if (!d->sText.isEmpty())
	{
		QFontMetrics fontMetrics(d->font);
		QRect txtRect = fontMetrics.boundingRect(d->boundRect.toRect(), d->textAlign, d->sText);
		path.addRect(txtRect);
	}
	return path;
}
Esempio n. 5
0
void CCJKShapeLinkNode::Paint(QPainter *painter)
{
	CJK_D(CCJKShapeLinkNode);
	BeginPaint(painter);
	QRectF tmpRect = BoundingRect();
	QBrush brsh(Qt::NoBrush);
	painter->setBrush(brsh);
	QPen pen(Qt::red);
	pen.setWidthF(1);
	pen.setJoinStyle(Qt::MiterJoin);
	pen.setCapStyle(Qt::RoundCap);
	painter->setPen(pen);
	painter->drawEllipse(tmpRect);
	painter->drawLine(tmpRect.topLeft(), tmpRect.bottomRight());
	painter->drawLine(tmpRect.topRight(), tmpRect.bottomLeft());
	if (d->tracker == TTTouch)
	{
		painter->drawRect(tmpRect);
	}
	EndPaint(painter);
}
CRect CStandardNodePositioning::BoundingRect 
    (const CStandardLayoutNodeInfo* node)
{
    // walk along this branch

    CRect result = node->rect;
    for ( ; node != NULL; node = node->nextInBranch)
    {
        result.UnionRect (result, node->rect);

        // shift sub-branches

        for ( CStandardLayoutNodeInfo* branch = node->firstSubBranch
            ; branch != NULL
            ; branch = branch->nextBranch)
        {
            result.UnionRect (result, BoundingRect (branch));
        }
    }

    return result;
}
void CPositionDisplay::Draw(const TRect& aRect) const
{
   CWindowGc& gc = SystemGc();
   gc.SetClippingRect(aRect);
   gc.SetBrushColor(iBgClr);
   gc.SetBrushStyle(CGraphicsContext::ESolidBrush);

   //gc.Clear(aRect); //paint background color.

   gc.SetPenStyle(CGraphicsContext::ESolidPen);
   gc.SetPenColor(iOutlineClr);
   gc.SetBrushColor(iFldClr);

   if(Contains(iLatControl->Rect(), aRect) || 
      Contains(iLonControl->Rect(), aRect)){
      return;
   }
   TRect bubbles[] = {BoundingRect(iLatControl->Rect(), iLonControl->Rect())};
   const TInt num = sizeof(bubbles)/sizeof(*bubbles);
   for(TInt i = 0; i < num; ++i){
      bubbles[i].Shrink(-2,-2);
      gc.DrawRoundRect(bubbles[i], TSize(8,8));
   }
}
Esempio n. 8
0
QPainterPath CCJKShapeElipse::GetPath() const
{
	QPainterPath path;
	path.addEllipse(BoundingRect());
	return path;
}
Esempio n. 9
0
void CCJKShapeElipse::Paint( QPainter *painter )
{
	BeginPaint(painter);
	painter->drawEllipse(BoundingRect());
	EndPaint(painter);
}
Esempio n. 10
0
void MapAnalysis::Resize
(
    const PLAYER_INDEX & maxPlayerId,
    const sint16 & xSize,
    const sint16 & ySize,
    const sint16 & resolution
)
{
    sint32 old_size = m_threatGrid.size();

    m_threatGrid        .resize(maxPlayerId);
    m_attackGrid        .resize(maxPlayerId);
    m_defenseGrid       .resize(maxPlayerId);
    m_rangedGrid        .resize(maxPlayerId);
    m_bombardLandGrid   .resize(maxPlayerId);
    m_bombardSeaGrid    .resize(maxPlayerId);
    m_bombardAirGrid    .resize(maxPlayerId);
    m_valueGrid         .resize(maxPlayerId);

    m_tradeAtRiskGrid   .resize(maxPlayerId);
    m_piracyLossGrid    .resize(maxPlayerId);
    m_empireBoundingRect.resize(maxPlayerId);
    m_empireCenter      .resize(maxPlayerId);

    for (sint16 player = 0; player < maxPlayerId; player++)
    {
        m_threatGrid     [player].Resize(xSize, ySize, resolution);
        m_attackGrid     [player].Resize(xSize, ySize, resolution);
        m_defenseGrid    [player].Resize(xSize, ySize, resolution);
        m_rangedGrid     [player].Resize(xSize, ySize, resolution);
        m_bombardLandGrid[player].Resize(xSize, ySize, resolution);
        m_bombardSeaGrid [player].Resize(xSize, ySize, resolution);
        m_bombardAirGrid [player].Resize(xSize, ySize, resolution);
        m_valueGrid      [player].Resize(xSize, ySize, resolution);
        m_tradeAtRiskGrid[player].Resize(xSize, ySize, resolution);
        m_piracyLossGrid [player].Resize(xSize, ySize, resolution);

        if (player >= old_size)
            m_empireBoundingRect[player] = BoundingRect();
    }

    m_piracyIncomeMatrix.resize(maxPlayerId * maxPlayerId, 0);

    m_minCityThreat.resize(maxPlayerId);
    m_maxCityThreat.resize(maxPlayerId);
    m_nuclearWeapons.resize(maxPlayerId);
    m_bioWeapons.resize(maxPlayerId);
    m_nanoWeapons.resize(maxPlayerId);
    m_specialAttackers.resize(maxPlayerId);
    m_continentSize.resize(maxPlayerId);
    m_totalPopulation.resize(maxPlayerId);
    m_landArea.resize(maxPlayerId);
    m_totalTrade.resize(maxPlayerId);
    m_projectedScience.resize(maxPlayerId);
    m_productionHandicapRatio.resize(maxPlayerId);
    m_goldHandicapRatio.resize(maxPlayerId);
    m_scienceHandicapRatio.resize(maxPlayerId);

    ResizeContinents();

    m_movementTypeUnion.resize(maxPlayerId);
}
Esempio n. 11
0
QPainterPath CCJKShapeLinkNode::GetShape() const
{
	QPainterPath path;
	path.addRegion(QRegion(BoundingRect().toRect(), QRegion::Rectangle));
	return path;
}
Esempio n. 12
0
QPainterPath CCJKShapeLinkNode::GetPath() const
{
	QPainterPath path;
	path.addRect(BoundingRect());
	return path;
}