⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fm_linedlg.m

📁 基于PSAT 软件的多目标最优潮流计算用于中小型电力系统的分析和管理
💻 M
📖 第 1 页 / 共 2 页
字号:
function fm_linedlg(varargin)%SCRIBELINEDLG   Line property dialog helper function for Plot Editor%%   Copyright 1984-2001 The MathWorks, Inc.%   $Revision: 1.19 $  $Date: 2001/04/15 12:00:41 $%%Modified by:    Federico Milano%Date:      11-Nov-2002%Version:   1.0.0%%E-mail:    fmilano@thunderbox.uwaterloo.ca%Web-site:  http://thunderbox.uwaterloo.ca/~fmilano%% Copyright (C) 2002-2006 Federico Milanopersistent localData;global Themeswitch nargincase 1    arg1 = varargin{1};    if isempty(arg1) | ishandle(arg1(1)) | isa(arg1(1), 'scribehandle')        localData = LInitFig(arg1,localData);        return    elseif ischar(arg1(1))        action = arg1;        parameter = [];    endcase 2    action = varargin{1};    parameter = varargin{2};endif strcmp(parameter,'me')    parameter = gcbo;endlocalData = feval(action,parameter,localData);%%%%%%function localData = LInitFig(objectV,localData)global Themeif isempty(objectV)    LNoLineError;    returnendtry    if ishandle(objectV)        fig = get(get(objectV(1),'Parent'),'Parent');    else        % might be any selected object        fig = get(objectV(1),'Figure');    endcatch    fm_disp(['Unable to edit line properties: invalid line handles']);    returnendoldPointer = get(fig,'Pointer');set(fig,'Pointer','watch');try    if ishandle(objectV)        LineVector = [];        ArrowVector = [];        for aHG = objectV            if strcmp(get(aHG,'Type'),'line')                LineVector(end+1) = aHG;            end        end    else        % pick out the line objects from the list        LineVector = scribehandle([]);        ArrowVector = scribehandle([]);        for aObj = objectV            if isa(aObj,'editline'),                LineVector = [LineVector aObj];                % LineVector(end+1) = aObj;            elseif isa(aObj,'arrowline')                ArrowVector = [ArrowVector aObj];                % ArrowVector(end+1) = aObj;            end        end    end    if isempty(LineVector)        IndLine = [];    else        IndLine = [1:length(LineVector)];    end    HG = [LineVector ArrowVector];catch    set(fig,'Pointer',oldPointer);    fm_disp(['Unable to open line properties dialog. ' ...            'Selection list is invalid:' ...            10 lasterr],2);    returnendif isempty(HG)    LNoLineError;    set(fig,'Pointer',oldPointer);    returnend%--temporary:  redirect to Property Editor%propedit(get(HG,'MyHGHandle'));%set(fig,'Pointer',oldPointer);%return%---Set enable flag for marker boxesif isequal(length(ArrowVector),length(HG)),    MarkerEnable='off';else    MarkerEnable='on';end%---Get all object datafor ctHG = 1:length(HG)    GetData(ctHG) = struct('Selected',get(HG(ctHG),'Selected'), ...        'Parent',get(HG(ctHG),'Parent'), ...        'LineStyle',get(HG(ctHG),'LineStyle'), ...        'LineWidth',get(HG(ctHG),'LineWidth'), ...        'Marker',get(HG(ctHG),'Marker'), ...        'MarkerSize',get(HG(ctHG),'MarkerSize'), ...        'Color',get(HG(ctHG),'Color'));    % turn off selection so we can see changes in marker style    set(HG(ctHG),'Selected','off');end % for ctHGlocalData = struct('CommonWidth',1,'CommonStyle',1,'CommonSize',1, ...    'CommonMarker',1,'CommonColor',1);localData.Selected = {GetData(:).Selected};try    % adjustment factors for character units    % work in character units.    fx = 5;    fy = 13;    figWidth = 360/fx;    figHeight = 220/fy;    callerPosition = get(fig,'Position');    callerUnits = get(fig,'Units');    bgcolor = get(0,'DefaultUIControlBackgroundColor');    if bgcolor==[0 0 0]        fgcolor = [1 1 1];    else        fgcolor = get(0,'DefaultUIControlForegroundColor');    end    fProps = struct(...        'Units', callerUnits,...        'Color', Theme.color01,...        'NumberTitle', 'off',...        'IntegerHandle', 'off',...        'Pointer','watch', ...        'Resize', 'on',...        'Visible', 'off',...        'KeyPressFcn', 'fm_linedlg keypress',...        'HandleVisibility', 'callback',...        'WindowStyle', 'modal',...        'CloseRequestFcn', 'fm_linedlg button close',...        'Name', 'Edit Line Properties',...        'Position', callerPosition);    f = figure(fProps);    set(f,'Units','character');    figPos = get(f,'Position');    figPos(1:2) = figPos(1:2) + (figPos(3:4)-[figWidth, figHeight])/2;    figPos(3:4) = [figWidth, figHeight];    set(f,'Position',figPos);    ut = uicontrol('Style'   , 'text',...        'Units'   , 'character',...        'Parent'  , f,...        'Visible' , 'off',...        'String'  , 'Title');    charSize = get(ut,'Extent');    charH = charSize(4);    delete(ut);    % geometry    LMarginW = 25/fx;    RMarginW = 25/fx;    ColPadW = 10/fx;    RowLabelW = 65/fx;    ColW = (figPos(3)-2*RowLabelW-LMarginW-RMarginW-3*ColPadW)/2;    TopMarginH = 20/fy;    BotMarginH = 20/fy;    RowH = 30/fy;    RowPadH = 8/fy;    uiH = RowH-RowPadH;    buttonW = 72/fx;    buttonH = RowH-RowPadH;    buttonPad = 7/fx;    charOffset = uiH-charH;    % property defaults    editProps = struct(...        'Style', 'edit',...        'Parent'  , f,...        'Units', 'character',...        'BackgroundColor', Theme.color04,...        'ForegroundColor', Theme.color05,...        'FontName',Theme.font01, ...        'HorizontalAlignment', 'left');    tProps = struct(...        'Style','text',...        'Parent'  , f,...        'Units', 'character',...        'HorizontalAlignment', 'right',...        'BackgroundColor', Theme.color01,...        'ForegroundColor', fgcolor);    prompt = {...            'Line Width:'        'Line Style:'        ''        'Color:'        'Marker Size:'        'Marker:'    };    properties = {...            'edit'    'fm_linedlg verifyposnumber me' 'LineWidth'        'popupmenu'   ''                              'LineStyle'        ''        ''                              ''        'frame'   ''     ''        'edit'    'fm_linedlg verifyposnumber me' 'MarkerSize'        'popupmenu'   ''                              'Marker'    };    linestyles =  {'-'  '--'  ':'  '-.' 'none'};    markers = {'none'  '+'  'o'  '*'  '.'  'x'  'square'  'diamond' ...            'v' '^'  '>'  '<'  'pentagram'  'hexagram'};    % Find common LineWidth and MarkerSize    CommonWidth = unique([GetData(:).LineWidth]);    if length(CommonWidth)>1,        widthStr = '';        localData.CommonWidth = 0;    else, widthStr = num2str(CommonWidth);    end    CommonSize = unique([GetData(IndLine).MarkerSize]);    if length(CommonSize)>1,        sizeStr = '';        localData.CommonSize = 0;    else, sizeStr = num2str(CommonSize);    end    % Find Common LineStyle    CommonStyle = unique({GetData(:).LineStyle});    if length(CommonStyle)==1,        styleVal = find(strcmp(CommonStyle{1},linestyles));        linestr = {'solid (-)'  'dash (--)'  'dot (:)'  'dash-dot (-.)'  'none'};    else        styleVal = 1;        localData.CommonStyle = 0;        linestyles = [{'Current'},linestyles];        linestr = {'Current'  'solid (-)'  'dash (--)'  'dot (:)'  'dash-dot (-.)'  'none'};    end    % Find Common Marker    markerVal = 1;    if ~isempty(IndLine),        CommonMarker = unique({GetData(IndLine).Marker});        if length(CommonMarker)==1,            markerVal = find(strcmp(CommonMarker{1},markers));        else            localData.CommonMarker = 0;            markers = [{'Current'},markers];        end    end    strings = {...            widthStr        linestr        ''        ''        sizeStr        markers    };    values = {...            0        styleVal        0        0        0        markerVal    };    enables = {...            'on'        'on'        'on'        'on'        MarkerEnable        MarkerEnable    };    data = {...            ''        linestyles        ''        ''        ''        markers    };    nRows = length(prompt);    % lay down prompts    Y = figPos(4)-TopMarginH-charOffset;    headingPosition = [LMarginW Y RowLabelW uiH];    for iRow=1:nRows        if iRow==5  % start new column            Y = figPos(4)-TopMarginH-charOffset;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -