Ejemplo n.º 1
0
int Game_Character::GetScreenZ() const {
	int z = this == Main_Data::game_player.get() ? 1 : 0;

	// For events on the screen, this should be inside a 0-40 range
	z += GetScreenY() >> 3;

	z += GetLayer() * 50;

	return z;
}
Ejemplo n.º 2
0
CCommonCtrl::~CCommonCtrl()
{
#if !defined(__CLIENT)
	#ifdef __LAYER_1021
	GetWorld()->m_respawner.Increment( GetRespawn(), m_nRespawnType, FALSE, GetLayer() );
	#else	// __LAYER_1021
	GetWorld()->m_respawner.Increment( GetRespawn(), m_nRespawnType, FALSE );
	#endif	// __LAYER_1021
#endif
}
Ejemplo n.º 3
0
void CComponent_Items::RenderSprite(const CNetObj_TU_Sprite *pPrev, const CNetObj_TU_Sprite *pCurrent)
{
	if(pCurrent->m_ItemLayer != GetLayer()) return;

	float Angle = mix(2.0*pi*static_cast<float>(pPrev->m_Angle)/360.0f, 2.0*pi*static_cast<float>(pCurrent->m_Angle)/360.0f, Client()->IntraGameTick());
	float Size = mix(pPrev->m_Size, pCurrent->m_Size, Client()->IntraGameTick());
	vec2 Pos = mix(vec2(pPrev->m_X, pPrev->m_Y), vec2(pCurrent->m_X, pCurrent->m_Y), Client()->IntraGameTick());
	
	TUKernel()->AssetsRenderer()->DrawSprite(pCurrent->m_SpriteId, Pos, Size, Angle, 0x0, 1.0f);
}
bool PLOT_CONTROLLER::OpenPlotfile( const wxString &aSuffix,
                                    PlotFormat     aFormat,
                                    const wxString &aSheetDesc )
{
    LOCALE_IO toggle;

    /* Save the current format: sadly some plot routines depends on this
       but the main reason is that the StartPlot method uses it to
       dispatch the plotter creation */
    GetPlotOptions().SetFormat( aFormat );

    // Ensure that the previous plot is closed
    ClosePlot();

    // Now compute the full filename for the output and start the plot
    // (after ensuring the output directory is OK)
    wxString outputDirName = GetPlotOptions().GetOutputDirectory() ;
    wxFileName outputDir = wxFileName::DirName( outputDirName );
    wxString boardFilename = m_board->GetFileName();

    if( EnsureFileDirectoryExists( &outputDir, boardFilename ) )
    {
        // outputDir contains now the full path of plot files
        m_plotFile = boardFilename;
        m_plotFile.SetPath( outputDir.GetPath() );
        wxString fileExt = GetDefaultPlotExtension( aFormat );

        // Gerber format can use specific file ext, depending on layers
        // (now not a good practice, because the official file ext is .gbr)
        if( GetPlotOptions().GetFormat() == PLOT_FORMAT_GERBER &&
            GetPlotOptions().GetUseGerberProtelExtensions() )
            fileExt = GetGerberProtelExtension( GetLayer() );

        // Build plot filenames from the board name and layer names:
        BuildPlotFileName( &m_plotFile, outputDir.GetPath(), aSuffix, fileExt );

        m_plotter = StartPlotBoard( m_board, &GetPlotOptions(), ToLAYER_ID( GetLayer() ),
                                    m_plotFile.GetFullPath(), aSheetDesc );
    }

    return( m_plotter != NULL );
}
Ejemplo n.º 5
0
void CModAPI_Component_Items::RenderModAPISprite(const CNetObj_ModAPI_Sprite *pPrev, const CNetObj_ModAPI_Sprite *pCurrent)
{
    if(pCurrent->m_ItemLayer != GetLayer()) return;
    if(!ModAPIGraphics()) return;

    float Angle = mix(2.0*pi*static_cast<float>(pPrev->m_Angle)/360.0f, 2.0*pi*static_cast<float>(pCurrent->m_Angle)/360.0f, Client()->IntraGameTick());
    float Size = mix(pPrev->m_Size, pCurrent->m_Size, Client()->IntraGameTick());
    vec2 Pos = mix(vec2(pPrev->m_X, pPrev->m_Y), vec2(pCurrent->m_X, pCurrent->m_Y), Client()->IntraGameTick());

    ModAPIGraphics()->DrawSprite(RenderTools(), pCurrent->m_SpriteId, Pos, Size, Angle, 0);
}
Ejemplo n.º 6
0
void
LayerComposite::AddBlendModeEffect(EffectChain& aEffectChain)
{
  gfx::CompositionOp blendMode = GetLayer()->GetEffectiveMixBlendMode();
  if (blendMode == gfx::CompositionOp::OP_OVER) {
    return;
  }

  aEffectChain.mSecondaryEffects[EffectTypes::BLEND_MODE] = new EffectBlendMode(blendMode);
  return;
}
Ejemplo n.º 7
0
	void DeferredRenderQueue::AddMesh(int renderOrder, const Material* material, const MeshData& meshData, const Boxf& meshAABB, const Matrix4f& transformMatrix)
	{
		if (material->IsBlendingEnabled() || material->IsDepthSortingEnabled()) //< Fixme: Deferred Shading should be able to handle depth sorting
			// Deferred Shading cannot handle blended objects, put them in the forward list
			m_forwardQueue->AddMesh(renderOrder, material, meshData, meshAABB, transformMatrix);
		else
		{
			Layer& currentLayer = GetLayer(renderOrder);
			MeshPipelineBatches& opaqueModels = currentLayer.opaqueModels;

			const MaterialPipeline* materialPipeline = material->GetPipeline();

			auto pipelineIt = opaqueModels.find(materialPipeline);
			if (pipelineIt == opaqueModels.end())
			{
				BatchedMaterialEntry materialEntry;
				pipelineIt = opaqueModels.insert(MeshPipelineBatches::value_type(materialPipeline, std::move(materialEntry))).first;
			}

			BatchedMaterialEntry& materialEntry = pipelineIt->second;
			MeshMaterialBatches& materialMap = materialEntry.materialMap;

			auto materialIt = materialMap.find(material);
			if (materialIt == materialMap.end())
			{
				BatchedModelEntry entry;
				entry.materialReleaseSlot.Connect(material->OnMaterialRelease, this, &DeferredRenderQueue::OnMaterialInvalidation);

				materialIt = materialMap.insert(MeshMaterialBatches::value_type(material, std::move(entry))).first;
			}

			BatchedModelEntry& entry = materialIt->second;
			entry.enabled = true;

			MeshInstanceContainer& meshMap = entry.meshMap;

			auto it2 = meshMap.find(meshData);
			if (it2 == meshMap.end())
			{
				MeshInstanceEntry instanceEntry;
				if (meshData.indexBuffer)
					instanceEntry.indexBufferReleaseSlot.Connect(meshData.indexBuffer->OnIndexBufferRelease, this, &DeferredRenderQueue::OnIndexBufferInvalidation);

				instanceEntry.vertexBufferReleaseSlot.Connect(meshData.vertexBuffer->OnVertexBufferRelease, this, &DeferredRenderQueue::OnVertexBufferInvalidation);

				it2 = meshMap.insert(std::make_pair(meshData, std::move(instanceEntry))).first;
			}

			std::vector<Matrix4f>& instances = it2->second.instances;
			instances.push_back(transformMatrix);

			materialEntry.maxInstanceCount = std::max(materialEntry.maxInstanceCount, instances.size());
		}
	}
Ejemplo n.º 8
0
int main()
{
	
	FILE* fp = nullptr;
	fopen_s(&fp, "import.psd", "rb");

	if (fp == nullptr) return 0;

	std::vector<uint8_t> data;
	fseek(fp, 0, SEEK_END);
	auto length = ftell(fp);
	fseek(fp, 0, SEEK_SET);

	data.resize(length);
	fread(data.data(), 1, length, fp);
	fclose(fp);

	auto doc = PSDParser::Document::Create(data.data(), data.size());

	for (auto i = 0; i < doc->GetLayerCount(); i++)
	{
		auto layer = doc->GetLayer(i);

		auto name = layer->GetName();
		auto rect = layer->GetRect();
		
		std::vector<uint8_t> bmp;
		auto height = rect.Bottom - rect.Top;
		auto width = rect.Right - rect.Left;
		bmp.resize(width * height * 4);

		for (int32_t y = 0; y < height; y++)
		{
			for (int32_t x = 0; x < width; x++)
			{
				auto p = (uint8_t*) layer->GetData();

				bmp[(x + y * width) * 4 + 0] = p[x * 4 + width * y + 0];
				bmp[(x + y * width) * 4 + 1] = p[x * 4 + width * y + 1];
				bmp[(x + y * width) * 4 + 2] = p[x * 4 + width * y + 2];
				bmp[(x + y * width) * 4 + 3] = p[x * 4 + width * y + 3];

			}
		}

		

		BitmapWriter::Write("test.bmp", (uint32_t*)(bmp.data()), width, height);

		//break;
	}

	return 0;
}
Ejemplo n.º 9
0
void CModAPI_Component_Items::RenderModAPIText(const CNetObj_ModAPI_Text *pPrev, const CNetObj_ModAPI_Text *pCurrent)
{
    if(pCurrent->m_ItemLayer != GetLayer()) return;
    if(!TextRender()) return;

    vec2 Pos = mix(vec2(pPrev->m_X, pPrev->m_Y), vec2(pCurrent->m_X, pCurrent->m_Y), Client()->IntraGameTick());

    char aText[64];
    IntsToStr(pCurrent->m_aText, 16, &aText[0]);

    ModAPIGraphics()->DrawText(TextRender(), aText, Pos, ModAPI_IntToColor(pCurrent->m_Color), pCurrent->m_Size, pCurrent->m_Alignment);
}
Ejemplo n.º 10
0
Matrix4x4
HostLayer::GetShadowTransform() {
  Matrix4x4 transform = mShadowTransform;
  Layer* layer = GetLayer();

  transform.PostScale(layer->GetPostXScale(), layer->GetPostYScale(), 1.0f);
  if (const ContainerLayer* c = layer->AsContainerLayer()) {
    transform.PreScale(c->GetPreXScale(), c->GetPreYScale(), 1.0f);
  }

  return transform;
}
Ejemplo n.º 11
0
bool Game_Event::CheckEventTriggerTouch(int x, int y) {
	if (Game_Map::GetInterpreter().IsRunning())
		return false;

	if (trigger == RPG::EventPage::Trigger_collision && !IsJumping()) {
		if (Main_Data::game_player->IsInPosition(GetX(), GetY()) && GetLayer() == RPG::EventPage::Layers_same) {
			return false;
		}

		if (Main_Data::game_player->IsInPosition(x, y) && !Main_Data::game_player->IsBlockedByMoveRoute()) {
			if (Main_Data::game_player->InAirship() && GetLayer() == RPG::EventPage::Layers_same) {
				return false;
			}

			Start();
			return true;
		}
	}

	return false;
}
void DRAWSEGMENT::Flip( const wxPoint& aCentre )
{
    m_Start.y  = aCentre.y - (m_Start.y - aCentre.y);
    m_End.y  = aCentre.y - (m_End.y - aCentre.y);

    if( m_Shape == S_ARC )
    {
        NEGATE( m_Angle );
    }

    SetLayer( FlipLayer( GetLayer() ) );
}
Ejemplo n.º 13
0
void CComponent_Items::RenderText(const CNetObj_TU_Text *pPrev, const CNetObj_TU_Text *pCurrent)
{
	if(pCurrent->m_ItemLayer != GetLayer()) return;
	if(!TextRender()) return;

	vec2 Pos = mix(vec2(pPrev->m_X, pPrev->m_Y), vec2(pCurrent->m_X, pCurrent->m_Y), Client()->IntraGameTick());
	
	char aText[64];
	IntsToStr(pCurrent->m_aText, 16, &aText[0]);
	
	TUKernel()->AssetsRenderer()->DrawText(aText, Pos, tu::IntToColor(pCurrent->m_Color), pCurrent->m_Size, pCurrent->m_Alignment);
}
Ejemplo n.º 14
0
  //
  // Export
  //
  // Export this footprint to the given file name
  //
  Bool Type::Export(const char *fileName)
  {
    PTree tree;
    FScope *root, *cellInfo;
  
    // Add the top level scope
    root = tree.GetGlobalScope()->AddFunction("ConfigureFootPrint");

    // Get the layer used for zipping
    Layer &layer = GetLayer(LAYER_LOWER);

    // Save out the grid
    for (S32 z = 0; z <= size.z; z++)
    {
      for (S32 x = 0; x <= size.x; x++)
      {
        // Write out cell info
        cellInfo = root->AddFunction("SetupCell");
        cellInfo->AddArgInteger(x);
        cellInfo->AddArgInteger(z);

        // Is this cell on the footprint
        if (x < size.x && z < size.z)
        {
          Cell &cell = GetCell(x, z);
          StdSave::TypeU32(cellInfo, "Hide", cell.GetFlag(HIDE));
          StdSave::TypeU32(cellInfo, "SetBase", cell.GetFlag(SETBASE));
          StdSave::TypeU32(cellInfo, "Second", cell.GetFlag(SECOND));
          StdSave::TypeU32(cellInfo, "Dirs", cell.dirs);
          StdSave::TypeU32(cellInfo, "ClaimLo", cell.GetFlag(CLAIMLO));
          StdSave::TypeU32(cellInfo, "ClaimHi", cell.GetFlag(CLAIMHI));
          StdSave::TypeU32(cellInfo, "BlockLOS", cell.GetFlag(BLOCKLOS));

          if (cell.GetFlag(SURFACE))
          {
            MoveTable::KeyInfo *info = MoveTable::FindSurfaceInfo(cell.surface);

            if (info)
            {
              StdSave::TypeString(cellInfo, "Surface", info->ident.str);
            }
          }
        }

        Layer::Cell &cell = layer.GetCell(x, z);
        StdSave::TypeU32(cellInfo, "Zip", cell.GetFlag(Layer::ZIP));
      }
    }
  
    // Save out to disk
    return (tree.WriteTreeText(fileName));
  }
Ejemplo n.º 15
0
bool PLOT_CONTROLLER::PlotLayer()
{
    LOCALE_IO toggle;

    // No plot open, nothing to do...
    if( !m_plotter )
        return false;

    // Fully delegated to the parent
    PlotOneBoardLayer( m_board, m_plotter, ToLAYER_ID( GetLayer() ), GetPlotOptions() );

    return true;
}
Ejemplo n.º 16
0
void TEXTE_MODULE::ViewGetLayers( int aLayers[], int& aCount ) const
{
    if( m_NoShow )      // Hidden text
        aLayers[0] = ITEM_GAL_LAYER( MOD_TEXT_INVISIBLE );
    //else if( IsFrontLayer( m_Layer ) )
        //aLayers[0] = ITEM_GAL_LAYER( MOD_TEXT_FR_VISIBLE );
    //else if( IsBackLayer( m_Layer ) )
        //aLayers[0] = ITEM_GAL_LAYER( MOD_TEXT_BK_VISIBLE );
    else
        aLayers[0] = GetLayer();

    aCount = 1;
}
Ejemplo n.º 17
0
void SCH_TEXT::Plot( PLOTTER* aPlotter )
{
    static std::vector <wxPoint> Poly;
    COLOR4D  color = GetLayerColor( GetLayer() );
    int      tmp = GetThickness();
    int      thickness = GetPenSize();

    // Two thicknesses are set here:
    // The first is for EDA_TEXT, which controls the interline spacing based on text thickness
    // The second is for the output that sets the actual stroke size
    SetThickness( thickness );
    aPlotter->SetCurrentLineWidth( thickness );

    if( IsMultilineAllowed() )
    {
        std::vector<wxPoint> positions;
        wxArrayString strings_list;
        wxStringSplit( GetShownText(), strings_list, '\n' );
        positions.reserve( strings_list.Count() );

        GetPositionsOfLinesOfMultilineText(positions, (int) strings_list.Count() );

        for( unsigned ii = 0; ii < strings_list.Count(); ii++ )
        {
            wxPoint textpos = positions[ii] + GetSchematicTextOffset();
            wxString& txt = strings_list.Item( ii );
            aPlotter->Text( textpos, color, txt, GetTextAngle(), GetTextSize(),
                            GetHorizJustify(), GetVertJustify(),
                            thickness, IsItalic(), IsBold() );
        }
    }
    else
    {
        wxPoint textpos = GetTextPos() + GetSchematicTextOffset();

        aPlotter->Text( textpos, color, GetShownText(), GetTextAngle(), GetTextSize(),
                        GetHorizJustify(), GetVertJustify(),
                        thickness, IsItalic(), IsBold() );
    }

    // Draw graphic symbol for global or hierarchical labels
    CreateGraphicShape( Poly, GetTextPos() );

    aPlotter->SetCurrentLineWidth( GetPenSize() );

    if( Poly.size() )
        aPlotter->PlotPoly( Poly, NO_FILL );

    SetThickness( tmp );
}
Ejemplo n.º 18
0
void ContourColorDlg::OnBnClickedOk()
{
    UpdateData( TRUE );

    // 获取图层名称
    CString layer;
    if( !GetLayer( layer ) )
    {
        MessageBox( _T( "没有选择包含等值线的图层" ) );
        return;
    }

    AcGeDoubleArray zValues;
    AcArray<COLORREF> colors;
    int n = m_colorList.GetItemCount();
    for( int i = 0; i < n; i++ )
    {
        ColorListItemData* pData = ( ColorListItemData* )m_colorList.GetItemData( i );
        zValues.append( pData->z );
        colors.append( pData->rgb );
    }
    // 删除最后一个z值
    zValues.removeLast();

    // 删除color list上的附加数据
    DeleteColorListItemDatas();

    // 获取图层上的等值线信息图元
    AcDbObjectId objId = GetContourInfoOnLayer( layer );
    SetContourInfo( objId, zValues, colors, m_bFillColor );

    // 获取边界坐标数据
    AcGePoint3dArray bounds;
    GetBoundaryPoints( bounds );
    if( bounds.isEmpty() )
    {
        MessageBox( _T( "请添加一个闭合的井田边界" ) );
        return;
    }

    // 获取点集数据
    AcGePoint3dArray datas;
    GetContourDatas( objId, datas );

    //assert((colors.length()-zValues.length()) == 1);
    // 绘制填充
    DrawFill( layer, bounds,  datas, zValues, colors, m_bFillColor );

    OnOK();
}
Ejemplo n.º 19
0
LayerType GetActiveLayerForConfig(const ConfigLocation& config)
{
  for (auto layer : SEARCH_ORDER)
  {
    if (!LayerExists(layer))
      continue;

    if (GetLayer(layer)->Exists(config))
      return layer;
  }

  // If config is not present in any layer, base layer is considered active.
  return LayerType::Base;
}
Ejemplo n.º 20
0
// --[  Method  ]---------------------------------------------------------------
//
//  - Class     : CEffect
//  - prototype : bool WriteASCII(CWriterASCII* pWriter)
//
//  - Purpose   : Writes the script data of the effect.
//
// -----------------------------------------------------------------------------
bool CEffect::WriteASCII(CWriterASCII* pWriter)
{
	assert(pWriter);
	assert(pWriter->Ready());

	// Description

	pWriter->Write("\n#Effect #Name=\"%s\" #Class=\"%s\"", GetFXName().data(), GetClassName().data());
	pWriter->Write("\n{");
	pWriter->Write("\n  #Begin=%f #End=%f #Layer=%u", GetBegin(), GetEnd(), GetLayer());

	// Resources

	MAPRESOURCES::iterator itRes;

	for(itRes = m_mapResources.begin(); itRes != m_mapResources.end(); ++itRes)
	{
		pWriter->Write("\n  #Resource #Name=\"%s\" #Class=\"%s\" #Value=\"%s\"",
						itRes->first.data(), itRes->second.strClass.data(), itRes->second.strValue.data());
	}
	
	// Variables

	MAPVARS::iterator itVar;

	pWriter->IncIndentation(2);
	pWriter->Write("\n");

	for(itVar = m_mapVars.begin(); itVar != m_mapVars.end(); ++itVar)
	{
		itVar->second->WriteASCII(pWriter);
	}

	pWriter->DecIndentation(2);

	// Commands

	pWriter->Write("\n");

	VECCOMMANDS::iterator itCmds;

	for(itCmds = m_vecCommands.begin(); itCmds != m_vecCommands.end(); ++itCmds)
	{
		pWriter->Write("\n  #Command #Time=%f #Send=<%s>", itCmds->fTime, itCmds->strCommand.data());
	}

	pWriter->Write("\n}");

	return true;
}
Ejemplo n.º 21
0
	void ForwardRenderQueue::AddDrawable(int renderOrder, const Drawable* drawable)
	{
		#if NAZARA_GRAPHICS_SAFE
		if (!drawable)
		{
			NazaraError("Invalid drawable");
			return;
		}
		#endif

		auto& otherDrawables = GetLayer(renderOrder).otherDrawables;

		otherDrawables.push_back(drawable);
	}
Ejemplo n.º 22
0
SdfSpecHandle
SdfPropertySpec::GetOwner() const
{
    SdfPath parentPath = GetPath().GetParentPath();

    // If this spec is a relational attribute, its parent path will be
    // a target path. Since Sdf does not provide specs for relationship targets
    // we return the target's owning relationship instead.
    if (parentPath.IsTargetPath()) {
        parentPath = parentPath.GetParentPath();
    }
    
    return GetLayer()->GetObjectAtPath(parentPath);
}
Ejemplo n.º 23
0
// *************************************************************
//		GetShapefile()
// *************************************************************
IShapefile* CMapView::GetShapefile(LONG LayerHandle)
{
	AFX_MANAGE_STATE(AfxGetStaticModuleState());
	
	Layer * layer = GetLayer(LayerHandle);
	if (!layer) return NULL;

	IShapefile* sf = NULL;
	if (layer->QueryShapefile(&sf)) {
		return sf;
	}
	
	return NULL;
}
Ejemplo n.º 24
0
// *************************************************************
//		GetOgrLayer()
// *************************************************************
IOgrLayer* CMapView::GetOgrLayer(LONG LayerHandle)
{
	AFX_MANAGE_STATE(AfxGetStaticModuleState());
	
	Layer * layer = GetLayer(LayerHandle);
	if (!layer) return NULL;
		
	IOgrLayer* ogr = NULL;
	if (layer->QueryOgrLayer(&ogr))	{
		return ogr;
	}
	
	return NULL;
}
Ejemplo n.º 25
0
// *************************************************************
//		GetWmsLayer()
// *************************************************************
IWmsLayer* CMapView::GetWmsLayer(LONG LayerHandle)
{
	AFX_MANAGE_STATE(AfxGetStaticModuleState());

	Layer * layer = GetLayer(LayerHandle);
	if (!layer) return NULL;

	IWmsLayer* wms = NULL;
	if (layer->QueryWmsLayer(&wms))	{
		return wms;
	}

	return NULL;
}
Ejemplo n.º 26
0
void CModAPI_Component_Items::RenderModAPILine(const struct CNetObj_ModAPI_Line *pCurrent)
{
    if(pCurrent->m_ItemLayer != GetLayer()) return;
    if(!ModAPIGraphics())
        return;
    //Geometry
    vec2 StartPos = vec2(pCurrent->m_StartX, pCurrent->m_StartY);
    vec2 EndPos = vec2(pCurrent->m_EndX, pCurrent->m_EndY);

    float Time = Client()->GameTick() + Client()->IntraGameTick() - pCurrent->m_StartTick;
    Time = (Time/static_cast<float>(SERVER_TICK_SPEED)) * 1000.0f;

    ModAPIGraphics()->DrawLine(RenderTools(),pCurrent->m_LineStyleId, StartPos, EndPos, Time);
}
void SCH_FIELD::Plot( PLOTTER* aPlotter )
{
    SCH_COMPONENT* parent = ( SCH_COMPONENT* ) GetParent();

    wxCHECK_RET( parent != NULL && parent->Type() == SCH_COMPONENT_T,
                 wxT( "Cannot plot field with invalid parent." ) );

    COLOR4D color = GetLayerColor( GetLayer() );

    if( !IsVisible() )
        return;

    if( IsVoid() )
        return;

    /* Calculate the text orientation, according to the component
     * orientation/mirror */
    int orient = GetTextAngle();

    if( parent->GetTransform().y1 )  // Rotate component 90 deg.
    {
        if( orient == TEXT_ANGLE_HORIZ )
            orient = TEXT_ANGLE_VERT;
        else
            orient = TEXT_ANGLE_HORIZ;
    }

    /* Calculate the text justification, according to the component
     * orientation/mirror
     * this is a bit complicated due to cumulative calculations:
     * - numerous cases (mirrored or not, rotation)
     * - the DrawGraphicText function recalculate also H and H justifications
     *      according to the text orientation.
     * - When a component is mirrored, the text is not mirrored and
     *   justifications are complicated to calculate
     * so the more easily way is to use no justifications ( Centered text )
     * and use GetBoundaryBox to know the text coordinate considered as centered
     */
    EDA_RECT BoundaryBox = GetBoundingBox();
    EDA_TEXT_HJUSTIFY_T hjustify = GR_TEXT_HJUSTIFY_CENTER;
    EDA_TEXT_VJUSTIFY_T vjustify = GR_TEXT_VJUSTIFY_CENTER;
    wxPoint  textpos = BoundaryBox.Centre();

    int      thickness = GetPenSize();

    aPlotter->Text( textpos, color, GetFullyQualifiedText(), orient, GetTextSize(),
            hjustify, vjustify,
            thickness, IsItalic(), IsBold() );
}
void GERBER_DRAW_ITEM::Show( int nestLevel, std::ostream& os ) const
{
    NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() <<

    " shape=\"" << m_Shape << '"' <<
    " addr=\"" << std::hex << this << std::dec << '"' <<
    " layer=\"" << GetLayer() << '"' <<
    " size=\"" << m_Size << '"' <<
    " flags=\"" << m_Flags << '"' <<
    " status=\"" << GetStatus() << '"' <<
    "<start" << m_Start << "/>" <<
    "<end" << m_End << "/>";

    os << "</" << GetClass().Lower().mb_str() << ">\n";
}
Ejemplo n.º 29
0
void ZONE_CONTAINER::AddPolygon( std::vector< wxPoint >& aPolygon )
{
    if( aPolygon.empty() )
        return;

    for( unsigned i = 0;  i < aPolygon.size();  i++ )
    {
        if( i == 0 )
            m_Poly->Start( GetLayer(), aPolygon[i].x, aPolygon[i].y, GetHatchStyle() );
        else
            AppendCorner( aPolygon[i] );
    }

    m_Poly->CloseLastContour();
}
Ejemplo n.º 30
0
// *************************************************************
//		GetImage()
// *************************************************************
IImage* CMapView::GetImage(LONG LayerHandle)
{
	AFX_MANAGE_STATE(AfxGetStaticModuleState());

	Layer * layer = GetLayer(LayerHandle);
	if (!layer) return NULL;

	IImage* img = NULL;
	if (layer->QueryImage(&img))
	{
		return img;
	}
	
	return NULL;
}