コード例 #1
0
void
avtMultiCurveLabelMapper::SetColors(const ColorAttributeList &c)
{
    cal = c;
    for (size_t i = 0; i < actors.size(); i++)
    {
        double col[4];
        GetLevelColor(colors[i], col);
        actors[i]->SetForegroundColor(col[0], col[1], col[2], col[3]);
    }
}
コード例 #2
0
wxColour wxJigsawShape::DrawBackground(wxDC & dc, 
		const wxPoint & pos, const wxSize & headerSize, 
		const wxSize & size, double scale)
{	
	wxColour color(m_Colour);
		
	if(wxJigsawEditorMainFrame::Get()->GetCanvas()->GetSelectedShape() == this)
	{
		//Shape selected. Give a feedback to the user!
		double bright =  1.15 + .08*GetLevelColor();

		color.Set(__min(bright*color.Red(), 255), __min(bright*color.Green(), 255), __min(bright*color.Blue(), 255));		
	}
	else if(m_Parent && m_Colour == m_Parent->GetColour())
	{
		//Change the shape bright to contrast with the parent shape
		double bright =  1 + .08*GetLevelColor();

		color.Set(__min(bright*color.Red(), 255), __min(bright*color.Green(), 255), __min(bright*color.Blue(), 255));
	}
	
	dc.SetBrush(wxBrush(color));
	dc.SetPen(*wxTRANSPARENT_PEN);
	
	wxPoint connector[5] = 
	{
		wxPoint(0,0), 
		wxPoint(wxJigsawShape::ConnectorSize.GetHeight(),
			wxJigsawShape::ConnectorSize.GetHeight()), 
		wxPoint(wxJigsawShape::ConnectorSize.GetWidth()-wxJigsawShape::ConnectorSize.GetHeight(),
			wxJigsawShape::ConnectorSize.GetHeight()), 
		wxPoint(wxJigsawShape::ConnectorSize.GetWidth(),0), 
		wxPoint(0,0)
	};
	for(size_t i = 0; i < 5; i++)
	{
		connector[i].x *= scale;
		connector[i].y *= scale;
	}
	wxSize childrenSize = GetChildrenSize(dc, scale);
	int cShapeHeight = wxMax(childrenSize.GetHeight(), 10*scale);
	wxRegion clippingRegion(0, 0, dc.GetSize().GetWidth(), dc.GetSize().GetHeight());
	if(m_HasNotch)
	{
		wxRegion connectorRegion(5, connector);
		connectorRegion.Offset(pos.x + wxJigsawShape::ConnectorSize.GetWidth()*scale, pos.y);
		clippingRegion.Xor(connectorRegion);
	}
	if(m_HasCShape)
	{
		wxRegion connectorRegion(5, connector);
		connectorRegion.Offset(
			pos.x + (wxJigsawShape::CShapeThickness+wxJigsawShape::ConnectorSize.GetWidth())*scale, 
			pos.y + headerSize.GetHeight()+cShapeHeight);
		clippingRegion.Xor(connectorRegion);
	}

	dc.SetClippingRegion(clippingRegion);
	//dc.DrawRoundedRectangle(m_Position.x, m_Position.y, headerSize.GetWidth(), headerSize.GetHeight(), 4);
	DrawShapeHeader(dc, pos, headerSize, IntToJigsawShapeStyle(m_Style));
	
	if(m_HasCShape)
	{
		dc.DrawRectangle(pos.x, 
			pos.y + headerSize.GetHeight() / 2, 
			(wxJigsawShape::CShapeThickness+4)*scale, 
			headerSize.GetHeight() / 2 + cShapeHeight + (wxJigsawShape::CShapeThickness*scale)/2);
		dc.DrawRoundedRectangle(pos.x, 
			pos.y + headerSize.GetHeight()+cShapeHeight, 
			headerSize.GetWidth(), 
			wxJigsawShape::CShapeThickness*scale, 4);
		// Upper inner notch
		dc.DrawPolygon(5, connector, 
			pos.x + (wxJigsawShape::CShapeThickness+wxJigsawShape::ConnectorSize.GetWidth())*scale, 
			pos.y + headerSize.GetHeight());
	}
	if(m_HasBump)
	{
		dc.DrawPolygon(5, connector, 
			pos.x + wxJigsawShape::ConnectorSize.GetWidth()*scale, 
			pos.y + size.GetHeight());
	}
	dc.DestroyClippingRegion();

	return color;
}
コード例 #3
0
void
avtMultiCurveLabelMapper::SetDatasetInput(vtkDataSet *ds, int inNum)
{
    if (ds == NULL || ds->GetNumberOfPoints() == 0 ||
        ds->GetNumberOfCells() == 0)
    {
        return;
    }

    if (inNum < 0)
    {
        EXCEPTION2(BadIndexException, inNum, 10);
    }

    double col[4];
    GetLevelColor(inNum, col);

    vtkIntArray *intArray = vtkIntArray::SafeDownCast(
        ds->GetPointData()->GetArray("CurveSymbols"));
    int *buf = (intArray == NULL) ? NULL : intArray->GetPointer(0);

    vtkIntArray *intArray2 = vtkIntArray::SafeDownCast(
        ds->GetPointData()->GetArray("CurveIds"));
    int *buf2 = (intArray2 == NULL) ? NULL : intArray2->GetPointer(0);

    //
    // If the number of points is greater than 500, then don't create the
    // markers and ids since the performance is so slow when the number of
    // actors is too large.
    //
    if (ds->GetNumberOfPoints() > 500)
        return;

    double    pos[3];        
    for (vtkIdType i = 0; i < ds->GetNumberOfPoints(); i++)
    {
        // Add the marker.
        avtLabelActor_p la = new avtLabelActor;
        ds->GetPoint(i, pos);
        la->SetAttachmentPoint(pos);
        if (buf != NULL)
            la->SetMarker(buf[i]);
        else
            la->SetMarker(2);
        la->SetScaleFactor(scale);
        la->SetLineWidth(LineWidth2Int(markerLineWidth));
        la->SetForegroundColor(col[0], col[1], col[2], col[3]);
        actors.push_back(la);
        colors.push_back(inNum);

        // Add the id.
        la = new avtLabelActor;
        ds->GetPoint(i, pos);
        la->SetAttachmentPoint(pos);
        char label[16];
        if (buf2 != NULL)
            if (buf2[i] != INT_MIN)
                sprintf(label, "%d", buf2[i]);
            else
                strcpy(label, "");
        else
            sprintf(label, "%lld", i);
        la->SetDesignator(label);
        la->SetScaleFactor(scale);
        la->SetForegroundColor(col[0], col[1], col[2], col[3]);
        actors.push_back(la);
        colors.push_back(inNum);
    }
}
コード例 #4
0
ファイル: Log.cpp プロジェクト: matheusportela/Poiesis
std::string Log::GetPrefix(LogLevel level)
{
    return GetLevelColor(level) + GetLevelString(level) + ": ";
}