code-layout/GeneratorCode/TmatrixSDK/OIDPublishImageGenerator.cs

333 lines
14 KiB
C#
Raw Normal View History

// ***********************************************************************
// Assembly : GeneratorCode
// Author : 黄昕 <hzhuangxin01@corp.netease.com>
// Created : 02-14-2019
//
// Last Modified By : 黄昕 <hzhuangxin01@corp.netease.com>
// Last Modified On : 02-19-2019
// ***********************************************************************
// <copyright file="OIDPublishImageGenerator.cs" company="NetEase">
// Copyright © 2019
// </copyright>
// <summary></summary>
// ***********************************************************************
using System.Runtime.InteropServices;
2019-02-12 03:43:15 +00:00
namespace OIDModule.Generator
{
/// <summary>
/// Enum OIDBeginBuildState
/// </summary>
2019-02-12 03:43:15 +00:00
internal enum OIDBeginBuildState
{
/// <summary>
/// The e bb state ok
/// </summary>
2019-02-12 03:43:15 +00:00
eBBState_OK,
/// <summary>
/// The e bb state image file not exist
/// </summary>
2019-02-12 03:43:15 +00:00
eBBState_ImageFileNotExist,
/// <summary>
/// The e bb state fail to open image file
/// </summary>
2019-02-12 03:43:15 +00:00
eBBState_FailToOpenImageFile,
/// <summary>
/// The e bb state unknown
/// </summary>
2019-02-12 03:43:15 +00:00
eBBState_Unknown
}
/// <summary>
/// Enum OIDPrintPointType
/// </summary>
2019-02-12 03:43:15 +00:00
internal enum OIDPrintPointType
{
/// <summary>
/// The e oid print point type 2X2
/// </summary>
2019-02-12 03:43:15 +00:00
eOID_PrintPointType_2x2,
/// <summary>
/// The e oid print point type 3X3
/// </summary>
2019-02-12 03:43:15 +00:00
eOID_PrintPointType_3x3,
/// <summary>
/// The e oid print point type 4X4
/// </summary>
2019-02-12 03:43:15 +00:00
eOID_PrintPointType_4x4
}
/// <summary>
/// Enum OIDPublishImageDPIType
/// </summary>
2019-02-12 03:43:15 +00:00
internal enum OIDPublishImageDPIType
{
/// <summary>
/// The e oid publish image dpi 600
/// </summary>
2019-02-12 03:43:15 +00:00
eOID_PublishImageDPI_600,
/// <summary>
/// The e oid publish image dpi 1200
/// </summary>
2019-02-12 03:43:15 +00:00
eOID_PublishImageDPI_1200
}
/// <summary>
/// Enum OIDPublishImageType
/// </summary>
2019-02-12 03:43:15 +00:00
internal enum OIDPublishImageType
{
/// <summary>
/// The e oid pit publish image
/// </summary>
2019-02-12 03:43:15 +00:00
eOID_PIT_Publish_Image,
/// <summary>
/// The e oid pit vertor image
/// </summary>
2019-02-12 03:43:15 +00:00
eOID_PIT_Vertor_Image,
/// <summary>
/// The e oid pit bg vertor image
/// </summary>
2019-02-12 03:43:15 +00:00
eOID_PIT_BG_Vertor_Image,
/// <summary>
/// The e oid pit publish bg image
/// </summary>
2019-02-12 03:43:15 +00:00
eOID_PIT_Publish_BG_Image
}
/// <summary>
/// Enum OIDPublishObjectType
/// </summary>
2019-02-12 03:43:15 +00:00
internal enum OIDPublishObjectType
{
/// <summary>
/// The e oid ot element code
/// </summary>
2019-02-12 03:43:15 +00:00
eOID_OT_ElementCode,
/// <summary>
/// The e oid ot position code
/// </summary>
2019-02-12 03:43:15 +00:00
eOID_OT_PositionCode
}
/// <summary>
/// Class OIDPublishImageGenerator.
/// </summary>
2019-02-12 03:43:15 +00:00
internal class OIDPublishImageGenerator
{
/// <summary>
/// Adds the object information.
/// </summary>
/// <param name="nPageIndex">Index of the n page.</param>
/// <param name="uiObjectIndex">Index of the UI object.</param>
/// <param name="arPointX">The ar point x.</param>
/// <param name="arPointY">The ar point y.</param>
/// <param name="nPointsCount">The n points count.</param>
/// <param name="nZOrder">The n z order.</param>
/// <param name="nObjectType">Type of the n object.</param>
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
public bool AddObjectInfo(int nPageIndex, ulong uiObjectIndex, uint[] arPointX, uint[] arPointY,
int nPointsCount, int nZOrder, int nObjectType)
2019-02-12 03:43:15 +00:00
{
return OID_PIG_AddObjectInfo(nPageIndex, uiObjectIndex, arPointX, arPointY, nPointsCount, nZOrder,
nObjectType);
2019-02-12 03:43:15 +00:00
}
/// <summary>
/// Begins the build publish image.
/// </summary>
/// <param name="szBGImage">The sz bg image.</param>
/// <param name="bExportPDFImage">if set to <c>true</c> [b export PDF image].</param>
/// <param name="nExportPDFImageDPI">The n export PDF image dpi.</param>
/// <returns>System.Int32.</returns>
2019-02-12 03:43:15 +00:00
public int BeginBuildPublishImage(char[] szBGImage, bool bExportPDFImage, int nExportPDFImageDPI)
{
return OID_PIG_BeginBuildPublishImage(szBGImage, bExportPDFImage, nExportPDFImageDPI);
}
/// <summary>
/// Begins the build publish image by information.
/// </summary>
/// <param name="dbCMWidth">Width of the database cm.</param>
/// <param name="dbCMHeight">Height of the database cm.</param>
/// <returns>System.Int32.</returns>
2019-02-12 03:43:15 +00:00
public int BeginBuildPublishImageByInfo(double dbCMWidth, double dbCMHeight)
{
return OID_PIG_BeginBuildPublishImageByInfo(dbCMWidth, dbCMHeight);
}
/// <summary>
/// Builds the publish image.
/// </summary>
/// <param name="szOutputFolderPath">The sz output folder path.</param>
/// <param name="bPrintIdleCode">if set to <c>true</c> [b print idle code].</param>
/// <param name="bSplitBigImage">if set to <c>true</c> [b split big image].</param>
/// <param name="bMergeSplittedImages">if set to <c>true</c> [b merge splitted images].</param>
/// <param name="nPublishImageDPIType">Type of the n publish image dpi.</param>
/// <param name="nPrintPointType">Type of the n print point.</param>
/// <param name="nPublishImageType">Type of the n publish image.</param>
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
public bool BuildPublishImage(char[] szOutputFolderPath, bool bPrintIdleCode, bool bSplitBigImage,
bool bMergeSplittedImages, int nPublishImageDPIType, int nPrintPointType, int nPublishImageType)
2019-02-12 03:43:15 +00:00
{
return OID_PIG_BuildPublishImage(szOutputFolderPath, bPrintIdleCode, bSplitBigImage, bMergeSplittedImages,
nPublishImageDPIType, nPrintPointType, nPublishImageType);
2019-02-12 03:43:15 +00:00
}
/// <summary>
/// Ends the build publish image.
/// </summary>
2019-02-12 03:43:15 +00:00
public void EndBuildPublishImage()
{
OID_PIG_EndBuildPublishImage();
}
/// <summary>
/// Initializes this instance.
/// </summary>
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
2019-02-12 03:43:15 +00:00
public bool Initialize()
{
return OID_PIG_Initialize();
}
/// <summary>
/// Sets the publish pages.
/// </summary>
/// <param name="arPageNumbers">The ar page numbers.</param>
/// <param name="nPageCount">The n page count.</param>
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
public bool SetPublishPages(int[] arPageNumbers, int nPageCount)
{
return OID_PIG_SetPublishPages(arPageNumbers, nPageCount);
}
/// <summary>
/// Sets the start position.
/// </summary>
/// <param name="nPageIndex">Index of the n page.</param>
/// <param name="nXStart">The n x start.</param>
/// <param name="nYStart">The n y start.</param>
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
public bool SetStartPosition(int nPageIndex, int nXStart, int nYStart)
{
return OID_PIG_SetStartPosition(nPageIndex, nXStart, nYStart);
}
/// <summary>
/// Uninitializes this instance.
/// </summary>
public void Uninitialize()
{
OID_PIG_Uninitialize();
}
/// <summary>
/// Oids the pig add object information.
/// </summary>
/// <param name="nPageIndex">Index of the n page.</param>
/// <param name="uiObjectIndex">Index of the UI object.</param>
/// <param name="arPointX">The ar point x.</param>
/// <param name="arPointY">The ar point y.</param>
/// <param name="nPointsCount">The n points count.</param>
/// <param name="nZOrder">The n z order.</param>
/// <param name="nObjectType">Type of the n object.</param>
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
[DllImport(@".\OIDPublishImageGenerator\OIDPublishImageGenerator.dll", CallingConvention =
CallingConvention.StdCall)]
private static extern bool OID_PIG_AddObjectInfo(int nPageIndex, ulong uiObjectIndex, uint[] arPointX,
uint[] arPointY, int nPointsCount, int nZOrder, int nObjectType);
/// <summary>
/// Oids the pig begin build publish image.
/// </summary>
/// <param name="szBGImage">The sz bg image.</param>
/// <param name="bExportPDFImage">if set to <c>true</c> [b export PDF image].</param>
/// <param name="nExportPDFImageDPI">The n export PDF image dpi.</param>
/// <returns>System.Int32.</returns>
[DllImport(@".\OIDPublishImageGenerator\OIDPublishImageGenerator.dll",
CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Unicode)]
private static extern int OID_PIG_BeginBuildPublishImage(char[] szBGImage, bool bExportPDFImage,
int nExportPDFImageDPI);
/// <summary>
/// Oids the pig begin build publish image by information.
/// </summary>
/// <param name="dbCMWidth">Width of the database cm.</param>
/// <param name="dbCMHeight">Height of the database cm.</param>
/// <returns>System.Int32.</returns>
[DllImport(@".\OIDPublishImageGenerator\OIDPublishImageGenerator.dll",
CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Unicode)]
2019-02-12 03:43:15 +00:00
private static extern int OID_PIG_BeginBuildPublishImageByInfo(double dbCMWidth, double dbCMHeight);
/// <summary>
/// Oids the pig build publish image.
/// </summary>
/// <param name="szOutputFolderPath">The sz output folder path.</param>
/// <param name="bPrintIdleCode">if set to <c>true</c> [b print idle code].</param>
/// <param name="bSplitBigImage">if set to <c>true</c> [b split big image].</param>
/// <param name="bMergeSplittedImages">if set to <c>true</c> [b merge splitted images].</param>
/// <param name="nPublishImageDPIType">Type of the n publish image dpi.</param>
/// <param name="nPrintPointType">Type of the n print point.</param>
/// <param name="nPublishImageType">Type of the n publish image.</param>
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
[DllImport(@".\OIDPublishImageGenerator\OIDPublishImageGenerator.dll",
CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Unicode)]
private static extern bool OID_PIG_BuildPublishImage(char[] szOutputFolderPath, bool bPrintIdleCode,
bool bSplitBigImage, bool bMergeSplittedImages, int nPublishImageDPIType, int nPrintPointType,
int nPublishImageType);
/// <summary>
/// Oids the pig end build publish image.
/// </summary>
[DllImport(@".\OIDPublishImageGenerator\OIDPublishImageGenerator.dll", CallingConvention =
CallingConvention.StdCall)]
2019-02-12 03:43:15 +00:00
private static extern void OID_PIG_EndBuildPublishImage();
/// <summary>
/// Oids the pig initialize.
/// </summary>
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
[DllImport(@".\OIDPublishImageGenerator\OIDPublishImageGenerator.dll", CallingConvention =
CallingConvention.StdCall)]
2019-02-12 03:43:15 +00:00
private static extern bool OID_PIG_Initialize();
/// <summary>
/// Oids the pig set publish pages.
/// </summary>
/// <param name="arPageNumbers">The ar page numbers.</param>
/// <param name="nPageCount">The n page count.</param>
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
[DllImport(@".\OIDPublishImageGenerator\OIDPublishImageGenerator.dll", CallingConvention =
CallingConvention.StdCall)]
2019-02-12 03:43:15 +00:00
private static extern bool OID_PIG_SetPublishPages(int[] arPageNumbers, int nPageCount);
/// <summary>
/// Oids the pig set start position.
/// </summary>
/// <param name="nPageIndex">Index of the n page.</param>
/// <param name="nXStart">The n x start.</param>
/// <param name="nYStart">The n y start.</param>
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
[DllImport(@".\OIDPublishImageGenerator\OIDPublishImageGenerator.dll", CallingConvention =
CallingConvention.StdCall)]
2019-02-12 03:43:15 +00:00
private static extern bool OID_PIG_SetStartPosition(int nPageIndex, int nXStart, int nYStart);
/// <summary>
/// Oids the pig uninitialize.
/// </summary>
[DllImport(@".\OIDPublishImageGenerator\OIDPublishImageGenerator.dll", CallingConvention =
CallingConvention.StdCall)]
2019-02-12 03:43:15 +00:00
private static extern void OID_PIG_Uninitialize();
}
}