是否有用于Web应用程序的UML编辑器库?

问题描述

只想知道Web应用程序的UML编辑器接口是否有任何库或框架支持。 我知道他们是可用于创建UML图的许多在线工具。但是需要知道是否有任何选项可用于将UML创建者界面集成到Web应用程序中。

解决方法

我非常喜欢MermaidJS(http://mermaid-js.github.io/mermaid/

我在自己的博客上将其用于图表。

以下是流程图(https://www.guilhermevrs.me/posts/time-management-for-leaders/)的示例

代码如下:

void ModRandomSelected(size_t numEl,int maxRad,int *pix_r){
  srand(time(NULL));
  int lenRandomIndex = NumberOfRandomS*sizeof(int);
  int* RandomIndex = (int*) malloc(lenRandomIndex);
  memset(RandomIndex,lenRandomIndex);
  
  int lenNumPerShell1 = (maxRad) * sizeof(int);
  int* numPerShell1 =  (int*) malloc(lenNumPerShell1);
  memset(numPerShell1,lenNumPerShell1);
  
  //Calculate the number of each pix_r per shell
  for (int i=numEl-1; i>=0; --i){
    numPerShell1[pix_r[i]]++;
  }
  
  //Main part for random selection of NumberOfRandomS items 
  //for each pix_r
  for(int r=maxRad-1; r>=0; --r)
  {
    int lenShellR = numPerShell1[r];

    //if number of items for this r is less than should be
    //selected,skip it. It means that we selected all items 
    //for this r
    if(lenShellR <= NumberOfRandomS){
      continue;
    }

    int lenCurrentR = lenShellR*sizeof(int);
    int* currentR = (int *) malloc(lenCurrentR); // array of indexes for this r
    memset(currentR,lenCurrentR);

    //filling currentR array with all indexes for this r
    int cInd = 0;
    for(register int i = numEl-1; i>=0; --i)
    {
      if(pix_r[i] == r){
        currentR[cInd] = i;
        cInd++;
      }
    }


    //generate random indexes without repetiotion that should be selected from currentR
    //this indexes help us to save r value in these positions and others indexes for this r
    //set to -1
    int value[NumberOfRandomS];
    for (int i=NumberOfRandomS-1; i>=0; --i)
    {
        int check; //variable to check or index is already used for this r
        size_t pick_index; //variable to store the random index in
        do
        {
        
        pick_index = rand() % lenShellR;
        //check or index is already used for this r:
        check=1;
        for (int j=0;j<i;++j)
            if (pick_index == value[j]) //if index is already used
            {
                check=0; //set check to false
                break; //no need to check the other elements of value[]
            }
        } while (check == 0); //loop until new,unique index is found
        value[i]=pick_index; //store the generated index in the array
        RandomIndex[i] = currentR[pick_index];
    }

    //set all positions for each r that are not on random selected to -1
    for(register int k=lenShellR-1; k >= 0; --k)
    {
      int flag = 0; // flag will be 1 if this index for this r in RandomIndex
      for (register int q = NumberOfRandomS-1; q >= 0; --q) 
      { 
        if(RandomIndex[q]== currentR[k]){
          flag = 1; //this index is found
        }
      }
      if(flag != 1)
      {
        //index for this r not in RandomIndex,so set this index for this r to -1
        pix_r[currentR[k]] = -1; 
      }
    }

  }
  return;
}