How to import any UML/XMI files to StarUML? - uml

I am trying to import a UML Diagram (of a C++ project) I designed in a program called Visual Paradigm.
This program allows me to save the UML diagram in various formats
)
and when I choose the XMI format (supported by StarUML through an extension
) it allows me to pick the XMI version to save the file
The problem comes when I try to import the file in StarUml: when I try to load an XMI file (I tried every version) that cames from V.P. it says "Failed to load the file";
On the other hand, if I save the diagram into UML2 format and then I try to open it, StarUML just does nothing.
Do You have any suggestions to work this problem out?
Here is a zip archive with another simpler project containing source code and XMI files (different versions) generated by Visual Paradigm: Project.rar

In StarUML Github Issues there is something very similar to you issue.
I had the same problem and the workaround proposed worked for me, search for
file "xmi-reader.js", then change in function "loadFromFile" the line:
var XMINode = dom.getElementsByTagName('XMI')[0]
to
var XMINode = dom.getElementsByTagName('xmi:XMI')[0]
Adding the name space "xmi:" to the name of the element makes it work.
Depending on you version of StarUML the file name could be xmi21-reader.js .

Related

How to use ReaderWriterOBJ in OpenSeneGraph

Can anyone explain to me how to use ReaderWriterOBJ in OpenSceneGraph? I want to load an obj file along with the mtl file. I have already built the solution for readerWriterObj code and created a dll file.
The ReaderWriter's are just file loaders. You have to use them in context of an application, like osgviewer, one of the examples included in OSG. If you've gone through the process of building OSG, you might have already built osgviewer, which will use the appropriate DLL's to load files.
eg
osgviewer FILE.obj
will open FILE.obj, with its associated material file[s].

Enterprise Architect Script: using ImportPackageXMI

I'm currently automating the process of importing XMI to Enterprise Architect using EA Script - JScript. I've been able to get definitions from existing packages GUID, Name, path to the package, create package.
The reference API from Sparx can be found here
Here's my current code
guid = "{3EC70CB6-28A1-40ed-ADD5-4B3AF5D89EED}"
Session.Output("GUID = " + guid);
Session.Output("GUID XML = " + project.GUIDtoXML(guid));
Session.Output("XMI file = " + svnPath + xmlPath);
result = project.ImportPackageXMI(project.GUIDtoXML(guid), svnPath + xmlPath, 1, 1);
Session.Output(result);
The following output shows that I got "Unknown package" while calling the API:
GUID = {3EC70CB6-28A1-40ed-ADD5-4B3AF5D89EED}
GUID XML = EAID_3EC70CB6_28A1_40ed_ADD5_4B3AF5D89EED
XMI file = D:\svn.xxx.com\yyy\docs\design\technical\class\Administration\SystemParameter.xml
Unknown package: EAID_3EC70CB6_28A1_40ed_ADD5_4B3AF5D89EED
I've googled for solution but google only shows about 17 results. The project Vienna in google code helps only a little.
So, does anyone know how to use ImportPackageXMI?
I can't tell from the information you've posted, but is it possible that you're trying to export a package from one project and import it into another?
Regardless of whether you tell EA to StripGUID, the package you import the XMI into must exist in the project, and that's what the PackageGUID specifies.
StripGUID 1 means a complete copy of the package contained in the XMI file is placed in the PackageGUID package. New GUIDs are created for all packages, elements, etc in the XMI file. In older versions of EA, this was the only way to make a deep copy of a package (Copy Package to Clipboard).
StripGUID 0 yields a few different results.
If the XMI package has the same GUID as PackageGUID, the current contents of the PackageGUID package are replaced by the XMI contents.
If the GUIDs are different:
If the XMI package GUID does not exist in the project, the XMI package is placed inside the PackageGUID package.
If the XMI package GUID exists, the import fails (conflicting packages).
In all four cases, the PackageGUID package must already exist.

Can't link known file extensions to custom editor classifier

I am working on an editor classifier extension for classic Visual Basic source files (module- and class files). The project has been created using the editor classifier project template from the Visual Studio 2012 SDK. The wizard created three code files: one for the classifier, one for the classifier-format and -provider and another one containing classification definitions. I made the following changes to the last one in order to link *.bas and *.cls files to my custom classifier...
using System.ComponentModel.Composition;
using Microsoft.VisualStudio.Text.Classification;
using Microsoft.VisualStudio.Utilities;
internal static class MyEditorClassifierClassificationDefinition
{
[Export(typeof(ClassificationTypeDefinition))]
[Name("MyEditorClassifier")]
internal static ClassificationTypeDefinition MyEditorClassifierType = null;
[Export]
[Name("custom")]
[BaseDefinition("code")]
internal static ContentTypeDefinition MyContentDefinition = null;
[Export]
[FileExtension(".bas")]
[ContentType("custom")]
internal static FileExtensionToContentTypeDefinition MyModuleFileExtensionDefinition = null;
[Export]
[FileExtension(".cls")]
[ContentType("custom")]
internal static FileExtensionToContentTypeDefinition MyClassFileExtensionDefinition = null;
}
The problem is, that Visual Studio does not invoke my classifier for files having *.bas, or *.cls extensions, instead the built-in editor for Visual Basic is used. I already tested my editor classifier using a custom file extension; in that case the classifier works as expected. I would like to know, if it's possible to change the classifier for known file extensions.
I found an intresting solution for classifying keywors are already classifyed by a language service. It's description says it uses a Tagger to enhance code highlighting. Maybe it can help you: KeywordClassifier
Older version of the linked project used a classifier mentioned in the description.
You can get the name of the loaded document, also the extension with ITextDocumentFactoryService or maybe there is a way to bind the tagger also to extensions not only to the content type of Basic (instead of code). FileExtensionAttribute may help.

Where does the Java Card "Converter" Tool look for EXP files?

using the JavaCard Converter tool, I kept getting errors like
error: export file rmi.exp of package java.rmi not found.
and
error: export file framework.exp of package javacard.framework not found.
The errors disappeared gradually after I copied the directories beneath
/usr/local/javacard/java_card_kit-2_2_2/api_export_files
to the local directory. Now, that's clearly a hack. No, calling this a 'hack' would be an insult to just about any other real hack. This is clearly not how things are supposed to work, right?
So, how do I tell the converter tool where it should be looking for the .exp-files?
And, yes, I've set JC_HOME=/usr/local/javacard/java_card_kit-2_2_2, too.
Quote from Java Card 2.1 Development Kit User’s Guide - November 15, 1999 document:
"
You can use the -exportpath command option to specify the locations of export
files. The path consists of a list of root directories in which the Converter looks for
export files. Export files must be named as the last portion of the package name
followed by the extension .exp. Export files are located in a subdirectory called
javacard, following the Java Card directory naming convention.
For example, to load the export file of the package java.lang, if you have specified
-exportpath as c:\myexportfiles, the Converter searches the directory
c:\myexportfiles\java\lang\javacard for the export file lang.exp.
"
I suppose it should apply for 2.2.2 too.
So use appropriate -exportpath option for converter to point to your exp files and be sure the javacard subdir is created under the package dir for holding exp files.

OpenCV 2.0 C++ API using imshow: returns unhandled exception and "bad-flag"

I'm trying to use the new OpenCV 2.0 API in MS Visual C++ 2008 and wrote this simple program:
cv::Mat img1 = cv::imread("image.jpg",1);
cv::namedWindow("My Window", CV_WINDOW_AUTOSIZE);
cv::imshow("My Window", img1);
Visual Studio returnes an unhandled exception and the Console returns:
OpenCV Error: bad flag (parameter or structure field)
(Unrecognized or unsupported array type) in unknown function,
file ..\..\..\..\ocv\opencv\src\cxcore\cxarray.cpp, line 2376
The image is not displayed. Furthermore the window "My Window" has a strange caption: "ÌÌÌÌMy Window", which is not dependent on the name.
The "old" C API using commands like cvLoadImage, cvNamedWindow or cvShowImage works without any problem for the same image file. I tried a lot of different stuff without success.
I appreciate any help here.
Konrad
As I just commented, imread isn't working for me either. A little googling shows other people having the same problem; I guess it's a bug in the library code. For now, here's a hacky workaround:
IplImage* img = cvLoadImage("lena.jpg");
cv::Mat lena(img);
cvReleaseImage(&img);
This way, you can at least use the C++ API for the rest of your stuff.
There's help for this issue.
The solution is, that the usual proposed opencv library files in the linker are not working properly. Instead try to use the debug library files by this:
In Visual C++:
go to Project->Properties (or Alt-F7)
Configuration Properties->Linker->Input->Additional Dependencies
replace the usual
" cv210.lib cxcore210.lib highgui210.lib" by
" cv210d.lib cxcore210d.lib highgui210d.lib" - which are the debugging libraries.
The OpenCv 2.0 API commands should work now.
I had the same problem described above which turns out to be caused by the settings of the linker.
I found the answer in another thread,
OpenCV 2.3 and Visual Studio 2010.
To repeat it here:
Properties of your project (right click on it)
C/C++
General
include directory add the < your directory >\OpenCV2.3\include\opencv2, < your directory >\OpenCV2.3\include\opencv and < your directory >\OpenCV2.3\include
Linker
General
List item
Input
Add all the libs like opencv_core230d.lib opencv_highgui230d.lib and so on...
Once I've done the above, I can run imshow and imread + all other cpp functions seamlessly! OP's problem has probably already been resolved, but hopefully this will be useful to other people who are led here looking for the same solution.
Are you sure you added the whole path starting from /home/.... I had the same problem as you but when I added the whole path, things work out pretty well. The whole path had to be added despite the fact the path exists in the include files.
imread in openCV unlike Matlab does not return an error when file/folder is not found - instead it returns a null matrix, which in turn is reflected as an error during imshow.
Also, imread does not look for image files in the included folders or the workspace. So, specify the entire path whenever possible.
Please take a note of this for future references.
Firstly, you'd better compile your own version OpenCV.
I had the same error with the build (I got from Sourceforge), and solved by compiling my own version in debug and release versions.
And make sure you change the original system env variable PATH to the new build folder build/bin, then you could build and run the imshow() in Debug mode.
I believe this might be related to unicode.
Try the macro _TEXT()
For example:
cv::Mat img1 = cv::imread(_TEXT("image.jpg"),1);
Unicode in Visual C++ 2

Resources