惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

S
Schneier on Security
有赞技术团队
有赞技术团队
T
The Blog of Author Tim Ferriss
F
Fortinet All Blogs
D
DataBreaches.Net
F
Full Disclosure
腾讯CDC
博客园 - 【当耐特】
MyScale Blog
MyScale Blog
Stack Overflow Blog
Stack Overflow Blog
小众软件
小众软件
Hugging Face - Blog
Hugging Face - Blog
Last Week in AI
Last Week in AI
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
爱范儿
爱范儿
The GitHub Blog
The GitHub Blog
Engineering at Meta
Engineering at Meta
大猫的无限游戏
大猫的无限游戏
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
S
SegmentFault 最新的问题
The Register - Security
The Register - Security
WordPress大学
WordPress大学
博客园 - 聂微东
雷峰网
雷峰网
J
Java Code Geeks
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
P
Privacy International News Feed
酷 壳 – CoolShell
酷 壳 – CoolShell
A
Arctic Wolf
Scott Helme
Scott Helme
C
Cyber Attacks, Cyber Crime and Cyber Security
T
Tor Project blog
博客园 - 三生石上(FineUI控件)
Know Your Adversary
Know Your Adversary
AWS News Blog
AWS News Blog
G
Google Developers Blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
C
CERT Recently Published Vulnerability Notes
O
OpenAI News
Project Zero
Project Zero
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Application and Cybersecurity Blog
Application and Cybersecurity Blog
云风的 BLOG
云风的 BLOG
N
News and Events Feed by Topic
MongoDB | Blog
MongoDB | Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Microsoft Security Blog
Microsoft Security Blog
Cisco Talos Blog
Cisco Talos Blog
P
Palo Alto Networks Blog
Schneier on Security
Schneier on Security

博客园 - Avlee

ArcGIS Server Manager 登录失败的解决方法 利用ArcSDE C API读取ArcSDE Raster数据 倡议以赞助的形式成立一个博客园的开发团队(博客园商业化尚早) 在WebGIS中试用Microsoft Silverlight有感 The MSVC project of the cairo library(version 1.4.6) WebGIS团队启用二级域名 Building the cairo graphic library using msvc Adobe 将停止对Adobe SVG Viewer的支持! SVG Authoring Guidelines[转] ArrayList.ToArray(Type) Or ArrayList.CopyTo(Array) Using Delegates with Data Readers to Control DAL Responsibility[转] 有了Flash和SVG,Adobe还想做什么呢? 基于Geomedia Professional平台的GIS应用开发(一) 根据权限创建页面上的功能按钮的一种简单有效的方法 如何让英文版的Adobe SVG Viewer显示中文文字 Adobe SVG Viewer 6.0 中自定义右键菜单 过年了,再忙也要回家...... 申请加入 “WebGIS” 团队 WebGIS团队刚刚成立
关于旧mdl程序向V8升级的问题
Avlee · 2005-11-24 · via 博客园 - Avlee

Mdl应用程序在Microstatin升级到V8过后,很多程序也需要相应的调整才能够运行。
其中代码需要变动最大的就是ModelRef和Tcb变量相关的方面,下面将陆续收集在Mdl程序升级过程中碰到的各种问题的一些解决方法。

关于TCB变量的变更:
Active Level

tcb->ad1.params.actlev 不再存在,可以使用mdlLevel_getActive和mdlLevel_setActive来访问和修改。

Active Font...
其他一些设置当前参数的tcb变量如tcb->actfont等, 可以使用mdlParams_getActive和mdlParams_setActive去访问和修改。

tcb->subpermast 和tcb->uorpersub
可以如下方法获取:

double GetUnit()
{
    
double            unit;
    DgnModelRefP    pModelRef;

    pModelRef 

= mdlModelRef_getActive();
    unit 
= mdlModelRef_getUorPerSub(pModelRef) * mdlModelRef_getSubPerMaster(pModelRef);
    
return unit;
}


tcb->globalorg
可以用如下方法去获取:

StatusInt GetGlobalOrigin(DPoint3d *globalOrigin)
{
    DgnModelRefP    pModelRef;
    
int             status;

    pModelRef 

= mdlModelRef_getActive();
    status 
= mdlModelRef_getGlobalOrigin(pModelRef, globalOrigin);
    
if (status == ERROR) {
        globalOrigin
->= 0.0;
        globalOrigin
->= 0.0;
        globalOrigin
->= 0.0;
    }
    
return status;
}

MSElementUnion
关于MSElementUnion结构体也有一些变化,主要包括:
MSElementUnion el;
el.hdr.dhdr.symb.b.weight 改为 el.hdr.dhdr.symb.weight;
el.hdr.dhdr.symb.b.style 改为 el.hdr.dhdr.symb.style;
el.hdr.dhdr.symb.b.color 改为 el.hdr.dhdr.symb.color;

el.hdr.dhdr.props.b.l  改为 el.ehdr.locked;
el.hdr.ehdr.xlow 改为 el.hdr.dhdr.range.xlowlim;
el.hdr.ehdr.ylow 改为 el.hdr.dhdr.range.ylowlim;
el.hdr.ehdr.xhigh 改为 el.hdr.dhdr.range.xhighlim;
el.hdr.ehdr.yhigh 改为 el.hdr.dhdr.range.yhighlim;

el.text_2d.dhdr.props.b.a 改为mdlElement_extractAttributes(&length,NULL,&el);

mdlView_fit
该函数接口有所变化,可以使用类似如下代码:

int FitCurrent(int view)
{
    
int status = TRUE;
    DgnModelRefP    modelRef;
    DgnModelRefListP modelRefListP;
    
    mdlModelRefList_create(
&modelRefListP);
    modelRef 
= mdlModelRef_getActive();
    mdlModelRefList_add(modelRefListP, modelRef);    
    
if (mdlView_fit(view, modelRefListP) != SUCCESS) {
        status 
= FALSE;
    }
    mdlModelRefList_free(
&modelRefListP);
    
return status;
}

Set levels mark to view
在J或更低版本中,经常需要在参考文件时设置levels mark,函数原形如下:

void mdlRefFile_attachCoincident
(
char      *filename,         /* => name of file to attach */
char      *logical,         /* => logical name */
char      *description,         /* => description (optional) */
short      levels[8][4],         /* => level bit maps */
boolean       snapLock,         
/* => initial state of snap lock */
boolean       locateLock         
/* => initial state of locate lock */
);


但是在V8中已经取消了levels mark参数,为了减少代码的改动,这里提供了一个和旧借口保持兼容的函数。
代码如下:

//------------------------------------------------------------------------------------
// Convert level codes to level ids.
// Input levelCodes and output levelIds is a set of " " or "," delimited in a string. 
// The string may contain ranges too. e.g. string: 1,10-15,3,20,25-28,31-35 
//------------------------------------------------------------------------------------
void cnvLevelCodesToIds(char *levelCodes, char *levelIds, DgnModelRefP pModelRef)
{
    
char *token;
    
char *rangeDelimiter;
    
char tempStr[512];
    
int  pos;
    ULong i, levelCodeStart, levelCodeEnd;
    ULong levelId 
= 0;
    
char seps[]   = " ,";if (levelCodes == NULL || levelIds == NULL)
        
return;

    strcpy(tempStr, levelCodes);
    levelIds[

0= '\0';

    token 

= strtok(tempStr, seps);
    
while (token != NULL) {
        rangeDelimiter 
= strchr(token, '-');
        
if (rangeDelimiter != NULL) {
            pos 
= rangeDelimiter - token;
            rangeDelimiter
++;
            token[pos] 
= '\0';
            levelCodeStart 
= atol(token);
            levelCodeEnd 
= atol(rangeDelimiter);
            
if (levelCodeStart > 0 && levelCodeEnd > levelCodeStart) {
                
for (i = levelCodeStart; i <= levelCodeEnd; i++) {
                    
if (mdlLevel_getIdFromCode(&levelId, pModelRef, i) == SUCCESS) 
                        sprintf(
&levelIds[strlen(levelIds)], "%ld,\0", levelId);
                }
            }
        }
        
else {
            levelCodeStart 
= atol(token);
            
if (levelCodeStart > 0) {
                
if (mdlLevel_getIdFromCode(&levelId, pModelRef, levelCodeStart) == SUCCESS)
                    sprintf(
&levelIds[strlen(levelIds)], "%ld,\0", levelId);
            }
        }
        
        token
= strtok (NULL, seps);
    }
if (strlen(levelIds) > 0)
        levelIds[strlen(levelIds) 
- 1= '\0';
}
//------------------------------------------------------------------------------------
// attachFileCoincident.
// To keep old code reusable, using the old parameter: unsigned short levels[8][4]
//------------------------------------------------------------------------------------
StatusInt attachFileCoincident(char *refFile, 
                            
char *logical, 
                            
char *description, 
                            unsigned 
short levels[8][4], 
                            BoolInt snapLock, 
                            BoolInt locateLock)
{
    DgnModelRefP    outModelRefP;
    MSWChar            wcLogName[
128];
    MSWChar            wcDescription[
128];
    
char            levelCodes[512];
    
char            levelIds[512];
    StatusInt        status;
    BitMask         
*levelMask = NULL;

    mdlCnv_convertMultibyteToUnicode(logical, 

-1, wcLogName, 128);

    mdlCnv_convertMultibyteToUnicode(description, 

-1, wcDescription, 128);

    status 

= mdlRefFile_attachCoincident(&outModelRefP, refFile, wcLogName, wcDescription, 
                            REF_FILE_LEVEL_DISPLAY_DEFAULT, snapLock, locateLock);
if (status == SUCCESS && levels != NULL) 
    {
        
/* Only set level mast for view 0 */

        mdlBitMask_createFromBitArray(

&levelMask, 64, levels[0], 1);
        mdlBitMask_getAsString(levelCodes, 
512, levelMask, 1);
        mdlBitMask_free(
&levelMask);
        levelMask 
= NULL;

        cnvLevelCodesToIds(levelCodes, levelIds, outModelRefP);

        mdlBitMask_create(

&levelMask, 0);
        mdlBitMask_setFromString(levelMask, levelIds, 
164);
        mdlView_setLevelDisplayMask(outModelRefP, 
0, levelMask, TRUE); 
        mdlBitMask_free(
&levelMask);
    }
return status;
}